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:54:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
I wrote a new different API:

New C API for variables only initialized once to be able to clear
them at exit:

    New macro _Py_ONCEVAR(var) to declare a variable
    New macro _PY_ONCEVAR_INIT(var, expr) to initialize a variable
    New function _PyOnceVar_Set() to explicitly set a variable once
    to initialize it
    New _PyOnceVar_Fini() function clearing all variables (initialized
    once) at exit

Variables keep their PyObject* type, but the API hides an internal C array tracking all Python objects to Py_DECREF them at exit in _PyOnceVar_Fini().

I used Nick's naming scheme since it seems like pthread has an existing API which is similar, but different (my API doesn't require an initialization callback).

I really prefer the second API using PyObject*.
Date User Action Args
2017-03-23 10:54:42vstinnersetrecipients: + vstinner, ncoghlan, eric.snow, serhiy.storchaka
2017-03-23 10:54:42vstinnersetmessageid: <>
2017-03-23 10:54:42vstinnerlinkissue29881 messages
2017-03-23 10:54:42vstinnercreate