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 scoder
Recipients Arfrever, Dormouse759, amaury.forgeotdarc, asvetlov, brett.cannon, eric.snow, eudoxos, gregory.p.smith, ncoghlan, petr.viktorin, pitrou, r.david.murray, scoder, twouters, vstinner
Date 2018-08-25.14:25:19
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1535207119.76.0.56676864532.issue32973@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-08-25 14:25:19scodersetrecipients: + scoder, twouters, brett.cannon, gregory.p.smith, amaury.forgeotdarc, ncoghlan, pitrou, vstinner, Arfrever, r.david.murray, petr.viktorin, asvetlov, eric.snow, eudoxos, Dormouse759
2018-08-25 14:25:19scodersetmessageid: <1535207119.76.0.56676864532.issue32973@psf.upfronthosting.co.za>
2018-08-25 14:25:19scoderlinkissue32973 messages
2018-08-25 14:25:19scodercreate