New submission from Eric Snow: Currently there isn't any way to uniquely identify an interpreter. This patch adds a new "id" field to the PyInterpreterState struct. The ID for every new interpreter is set to the value of an increasing global counter. That means that the ID is unique within the process.
IIRC, the availability of unique ID would help tools that make use of subinterpreters, like mod_wsgi. It is also necessary for any effort to expose interpreters in Python-level code (which is the subject of other ongoing work). The patch also adds: unsigned long PyInterpreterState_GetID(PyInterpreterState *interp) Note that, without a Python-level interpreters module, testing this change is limited to extending the existing test code in test_capi. ---------- assignee: eric.snow components: Interpreter Core files: interpreter-id.diff keywords: patch messages: 284229 nosy: brett.cannon, eric.snow, grahamd, ncoghlan, steve.dower priority: normal severity: normal stage: patch review status: open title: Add an id field to PyInterpreterState. type: enhancement versions: Python 3.7 Added file: http://bugs.python.org/file46070/interpreter-id.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29102> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com