This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients eric.snow, ncoghlan, serhiy.storchaka, vstinner
Date 2017-03-23.10:20:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
Serhiy: "The patch contains an example of using _Py_STATICVAR(). But it doesn't use _PY_STATICVAR_INIT()."

I'm not sure that I understand your comment. All modified code use _Py_STATICVAR() to declare the declare. All modified code use _PY_STATICVAR_INIT() to initialize the variable, except of array_array___reduce_ex__() which uses explicitly _PyStaticVar_Set() beause its initialization code is more complex.

_PyStaticVar_Set() is the low-level function, I would prefer to avoid it since it fails with an assertion error if it's called twice. _PY_STATICVAR_INIT() helper should be perfer since it makes the code shorter, but it's similar to simple expressions like PyUnicode_FromString("\n").

I tried to include examples of usage of both APIs to give you an idea of the API.

I chose to *not* patch the whole Python code base, because I would like to first get a review of a the API. It seems like alternatives have been proposed ;-)

> I like the idea in general, but I want to see more examples.

Which kind of other examples do you need?
Date User Action Args
2017-03-23 10:20:02vstinnersetrecipients: + vstinner, ncoghlan, eric.snow, serhiy.storchaka
2017-03-23 10:20:02vstinnersetmessageid: <>
2017-03-23 10:20:02vstinnerlinkissue29881 messages
2017-03-23 10:20:02vstinnercreate