On Wed, Dec 15, 2021 at 3:07 AM Victor Stinner <vstin...@python.org> wrote: > I wrote https://bugs.python.org/issue39511 and > https://github.com/python/cpython/pull/18301 to have per-interpreter > None, True and False singletons. My change is backward compatible on > the C API: you can still use "Py_None" in your C code. The code gets > the singleton object from the current interpreter with a function > call: > > #define Py_None Py_GetNone() > > Py_GetNone() is implemented as: "return _PyInterpreterState_GET()->none;"
It's backward compatible for the C API, but not for the stable C ABI -- that exports Py_None directly as a symbol. You also need a solution for all the static global PyTypeObjects in C extensions. I don't think there's any API-compatible way to make those heap-allocated. -n -- Nathaniel J. Smith -- https://vorpus.org _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/HS3NENZXKYSBCN4OVUOZ2CUX55Z5CXG5/ Code of Conduct: http://python.org/psf/codeofconduct/