[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 06:22:01 EDT 2017


STINNER Victor added the comment:

#define _Py_ONCE_VAR(var_decl, var) \
      var_decl var = NULL;
      static _Py_OnceVar var ## _once_meta = {.next = NULL, .obj_ref = (PyObject **) &var}

Yeah, I had a similar idea, but I fear that it will increase the usage of the C stack memory.

See the issue #28858: my old _PyObject_CallArg1() macro allocated an implicit array on the stack and increased the stack usage, whereas the purpose of the macro was to *reduce* the stack usage (just the opposite!). So I removed the macro.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29881>
_______________________________________


More information about the Python-bugs-list mailing list