Stefan Behnel <stefan...@behnel.de> added the comment: Well, first of all, it's better than a crash. :)
Secondly, I'm sure NumPy doesn't currently support subinterpreters, just like most other extension modules. If I'm not mistaken, an interpreter switch can be detected through the interpreter state pointer [1] in the thread state, and extension modules that lack subinterpreter support can consider a change an error for them. since then something is trying to re-import the module into a different interpreter. That's not entirely safe since addresses can be reused, which I guess was the reason for adding an ID [2] in Py3.7, but that's only available in Py3.7+, not in Py3.5. So, the interpreter address is probably as good as it gets for Py<3.7. [1] https://docs.python.org/3/c-api/init.html#c.PyThreadState [2] https://docs.python.org/3/c-api/init.html#c.PyInterpreterState_GetID Note: I'm not trying to keep anyone from implementing subinterpreter support here – just showing a way to keep things working and improving gradually as long as there is no full support for PEP 489, extension module reloading and subinterpreters, so that users don't have to go all the way in one step. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32973> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com