Graham Dumpleton <graham.dumple...@gmail.com> added the comment: This new problem I am seeing looks like it may be linked to where the 'atexit' module is initialised/imported in a sub interpreter but never in the main interpreter. I can avoid the crash by having:
PyImport_ImportModule("atexit"); Py_Finalize(); At a guess, this is because: module = PyState_FindModule(&atexitmodule); if (module == NULL) return; still returns a module for case where imported in a sub interpreter but not in main interpreter, but then: modstate = GET_ATEXIT_STATE(module); if (modstate->ncallbacks == 0) return; returns NULL for modstate for the main interpreter as PyInit_atexit() had never been called for the main interpreter. The fix would appear to be to check modstate for being NULL and return. Ie., module = PyState_FindModule(&atexitmodule); if (module == NULL) return; modstate = GET_ATEXIT_STATE(module); if (modstate == NULL) return; if (modstate->ncallbacks == 0) return; Does that make sense to anyone? If it does and I am correct, I'll create a new issue for it as original fix seems deficient. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue4200> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com