[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

2009-07-21 Thread Graham Dumpleton
Graham Dumpleton added the comment: Have created issue6531 for my new issue related to this patch. -- ___ Python tracker ___ ___ Pytho

[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

2009-07-20 Thread Graham Dumpleton
Graham Dumpleton 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();

[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

2009-07-19 Thread Benjamin Peterson
Benjamin Peterson added the comment: 2009/7/19 Graham Dumpleton : > > Graham Dumpleton added the comment: > > I know this issue is closed, but for this patch, the code: > > +    modstate = get_atexitmodule_state(module); > + > +    if (modstate->ncallbacks == 0) > +        return; > > was added

[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

2009-07-19 Thread Graham Dumpleton
Graham Dumpleton added the comment: I know this issue is closed, but for this patch, the code: +modstate = get_atexitmodule_state(module); + +if (modstate->ncallbacks == 0) +return; was added. Is there any condition under which modstate could be NULL. Haven't touched Python 3

[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

2008-10-30 Thread Christian Heimes
Christian Heimes <[EMAIL PROTECTED]> added the comment: Fixed in r67054 -- resolution: -> fixed status: open -> closed ___ Python tracker <[EMAIL PROTECTED]> ___ _

[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

2008-10-29 Thread Graham Dumpleton
Graham Dumpleton <[EMAIL PROTECTED]> added the comment: In conjunction with #3723 and #4213, the attached atexit_modulestate.patch appears to fix issue for mod_wsgi. ___ Python tracker <[EMAIL PROTECTED]> ___

[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

2008-10-28 Thread Benjamin Peterson
Benjamin Peterson <[EMAIL PROTECTED]> added the comment: This patch looks fine. -- nosy: +benjamin.peterson ___ Python tracker <[EMAIL PROTECTED]> ___ _

[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

2008-10-28 Thread Graham Dumpleton
Graham Dumpleton <[EMAIL PROTECTED]> added the comment: By visual inspection the intent looks correct, but can't actually test it until I can checkout Python code from source repository and apply patch as patch doesn't apply cleanly to 3.0rc1. With #3723 and #4213 now also having patches, will

[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

2008-10-28 Thread Christian Heimes
Christian Heimes <[EMAIL PROTECTED]> added the comment: Martin, can you please review and comment on my patch? Graham, does the patch solve your problem? -- assignee: -> loewis ___ Python tracker <[EMAIL PROTECTED]>

[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

2008-10-26 Thread Christian Heimes
Changes by Christian Heimes <[EMAIL PROTECTED]>: -- priority: critical -> release blocker ___ Python tracker <[EMAIL PROTECTED]> ___ ___

[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

2008-10-26 Thread Christian Heimes
Christian Heimes <[EMAIL PROTECTED]> added the comment: Can you review the patch, Martin? I've moved the three state variables into a module state struct. The patch also fixes the METH_NOARGS functions. -- keywords: +needs review, patch Added file: http://bugs.python.org/file11894/atexit

[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

2008-10-26 Thread Christian Heimes
Christian Heimes <[EMAIL PROTECTED]> added the comment: Ah, thanks. I'll try PyState_FindModule(). ___ Python tracker <[EMAIL PROTECTED]> ___ ___

[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

2008-10-26 Thread Martin v. Löwis
Martin v. Löwis <[EMAIL PROTECTED]> added the comment: Christian Heimes wrote: > However PyModule_GetDef requires self. (I actually meant PyModule_GetState). You can use PyState_FindModule to quickly lookup a module. ___ Python tracker <[EMAIL PROTECTED]>

[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

2008-10-26 Thread Christian Heimes
Christian Heimes <[EMAIL PROTECTED]> added the comment: I'm trying to come up with a patch. It's a little bit trickier than I thought. The atexit module registers "atexit_callfuncs()" with _Py_PyAtExit(). The "atexit_callfuncs()" function is called by Python/pythonrun.c when the interpreter exits

[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

2008-10-26 Thread Martin v. Löwis
Martin v. Löwis <[EMAIL PROTECTED]> added the comment: It would certainly be possible to produce per-interpreter callback lists through the module state. You declare a per-interpreter structure, add its size into atexitmodule, and refer to it through PyModule_GetDef, passing the self argument of

[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

2008-10-26 Thread Christian Heimes
Christian Heimes <[EMAIL PROTECTED]> added the comment: I'm adding Martin to the nosy list as well. He is the author of PEP 3121 and he might be able to give more insight in the problem. -- nosy: +loewis ___ Python tracker <[EMAIL PROTECTED]>

[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

2008-10-24 Thread Graham Dumpleton
Graham Dumpleton <[EMAIL PROTECTED]> added the comment: I wouldn't be concerned about mod_python as likelihood that it will be ported is very low and even if it was it would be a long long way in the future. There is too much in mod_python itself unrelated to Python 3.0 that needs to be fixed

[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

2008-10-24 Thread Christian Heimes
Christian Heimes <[EMAIL PROTECTED]> added the comment: Ouch! We totally forgot about sub interpreters during the reimplementation of the atexit module. In my opinion it's a big bug for systems like mod_python and mod_wsgi. However it's too late to fix it for 3.0.0. Perhaps we can fix it in 3.0

[issue4200] atexit module not safe in Python 3.0 with multiple interpreters

2008-10-24 Thread Graham Dumpleton
New submission from Graham Dumpleton <[EMAIL PROTECTED]>: In Python 3.0 the atexit module was translated from Python code to C code. Prior to Python 3.0, because it was implemented at C code level, the list of callbacks was specific to each sub interpreter. In Python 3.0 that appears to no lon