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 amaury.forgeotdarc
Recipients Larry.Pete, alexandre.vassalotti, amaury.forgeotdarc, pitrou
Date 2013-09-25.20:53:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1380142437.6.0.912034327649.issue19088@psf.upfronthosting.co.za>
In-reply-to
Content
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()
History
Date User Action Args
2013-09-25 20:53:57amaury.forgeotdarcsetrecipients: + amaury.forgeotdarc, pitrou, alexandre.vassalotti, Larry.Pete
2013-09-25 20:53:57amaury.forgeotdarcsetmessageid: <1380142437.6.0.912034327649.issue19088@psf.upfronthosting.co.za>
2013-09-25 20:53:57amaury.forgeotdarclinkissue19088 messages
2013-09-25 20:53:57amaury.forgeotdarccreate