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, shihai1991, vstinner
Date 2020-01-29.23:08:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1580339280.96.0.81606549661.issue39487@roundup.psfhosted.org>
In-reply-to
Content
> That means this is a useful refactoring to help identify blockers to full subinterpreter support.

I don't think that subinterpreter support should block this issue, since currently, _Py_IDENTIFIER() does *not* support subinterpreters.

> In the subinterpreter context: perhaps it would make sense to move *all* Py_IDENTIFIER declarations to file scope?

What do you mean? _Py_IDENTIFIER() macro uses "static", so no identifier is visible outside the current C file. The scope may be the whole file, or the current function, depending where it's declared.

--

Once I discussed with Eric: _Py_IDENTIFIER() should use an "interpreter local storage" for identifiers values. _Py_IDENTIFIER() would only be a "key" and _PyUnicode_FromId() would store the value somewhere in a hash table stored in PyInterpreterState. Something similar to the TSS API:

* PyThread_create_key()
* PyThread_delete_key_value()
* PyThread_set_key_value()
* PyThread_get_key_value()

But per interpreter, rather than being per thread.

The key can be simply the variable address in memory. It only has to be unique in the process.
History
Date User Action Args
2020-01-29 23:08:01vstinnersetrecipients: + vstinner, ncoghlan, eric.snow, shihai1991
2020-01-29 23:08:00vstinnersetmessageid: <1580339280.96.0.81606549661.issue39487@roundup.psfhosted.org>
2020-01-29 23:08:00vstinnerlinkissue39487 messages
2020-01-29 23:08:00vstinnercreate