Message290036
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:02 | vstinner | set | recipients:
+ vstinner, ncoghlan, eric.snow, serhiy.storchaka |
2017-03-23 10:20:02 | vstinner | set | messageid: <1490264402.93.0.399179638511.issue29881@psf.upfronthosting.co.za> |
2017-03-23 10:20:02 | vstinner | link | issue29881 messages |
2017-03-23 10:20:02 | vstinner | create | |
|