Message198417
The NoneType that fails is in typeobject.c:
_PyObject_CallMethodId(copyreg, &PyId__slotnames, "O", cls);
The error here is that copyreg comes from a cached reference to the module, stored in a static variable (cached_copyreg_module). When the interpreter shuts down the first time, all the module members are set to None... but the reference is kept forever.
This variable should be reset, and reloaded (with a fresh module from the new interpreter) the next time it's used.
I added a call to _PyType_Fini() in Py_EndInterpreter, this fixes the given example.
Two sets of questions though:
- There are many of these _Fini functions, called in Py_Finalize. Which ones should we call in Py_EndInterpreter? and why? Maybe this PyType_Fini() is not a _Fini, but should be renamed PyType_EndInterpreter?
- one copyreg for multiple interpreters... this looks wrong: each interpreter has its own list of modules, but copyreg.__globals__ belongs to only one...
A good solution would be to cache the copyreg module in the PyInterpreterState (it already has codec_search_cache). Or use PyImport_GetModuleDict() |
|
Date |
User |
Action |
Args |
2013-09-25 20:53:57 | amaury.forgeotdarc | set | recipients:
+ amaury.forgeotdarc, pitrou, alexandre.vassalotti, Larry.Pete |
2013-09-25 20:53:57 | amaury.forgeotdarc | set | messageid: <1380142437.6.0.912034327649.issue19088@psf.upfronthosting.co.za> |
2013-09-25 20:53:57 | amaury.forgeotdarc | link | issue19088 messages |
2013-09-25 20:53:57 | amaury.forgeotdarc | create | |
|