[issue29881] Add a new private API for "static C variables" (_PyStaticVar) to clear them at exit
STINNER Victor
report at bugs.python.org
Thu Mar 23 12:30:26 EDT 2017
STINNER Victor added the comment:
About _PY_ONCEVAR_INIT() vs _Py_IDENTIFIER.
Using _Py_IDENTIFIER works well if you have an API accepting directly a _Py_IDENTIFIER*. If you call functions requesting a PyObject*, you need to call _PyUnicode_FromId() and test for failure. If you start by calling _PyUnicode_FromId() when the object is not initialized yet, above you have to use var.object, whereas previously Serhiy and Nick weren't confortable with this specific case.
I prefer to use _PY_ONCEVAR_INIT() to keep a regular PyObject* variable and makes the code simpler.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29881>
_______________________________________
More information about the Python-bugs-list
mailing list