➜

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.

作者 vstinner
收信人 eric.snow, ncoghlan, serhiy.storchaka, vstinner
日期 2017-03-23.10:54:42
SpamBayes Score -1.0
Marked as misclassified 是
Message-id <1490266482.75.0.76285351757.issue29881@psf.upfronthosting.co.za>
In-reply-to
内容
I wrote a new different API: https://github.com/python/cpython/pull/780

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
    once
    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*.
历史
日期 用户 动作 参数
2017-03-23 10:54:42vstinner修改recipients: + vstinner, ncoghlan, eric.snow, serhiy.storchaka
2017-03-23 10:54:42vstinner修改messageid: <1490266482.75.0.76285351757.issue29881@psf.upfronthosting.co.za>
2017-03-23 10:54:42vstinner链接issue29881 messages
2017-03-23 10:54:42vstinner创建