STINNER Victor <vstin...@python.org> added the comment:
> 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. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39487> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com