Mailing List Archive

[issue5099] subprocess.POpen.__del__() AttributeError (os module == None!)
Changes by Mary Stern <marystern@yahoo.com>:


----------
title: subprocess.POpen.__del__() AttribuetError (os module == None!) -> subprocess.POpen.__del__() AttributeError (os module == None!)

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5099>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5099] subprocess.POpen.__del__() AttributeError (os module == None!) [ In reply to ]
Changes by David W. Lambert <lambertdw@corning.com>:


----------
nosy: +LambertDW

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5099>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5099] subprocess.POpen.__del__() AttributeError (os module == None!) [ In reply to ]
Gabriel Genellina <gagsl-py2@yahoo.com.ar> added the comment:

At interpreter shutdown, the module's global variables are set to None
before the module itself is released. __del__ methods may be called in
those precaries circumstances, and should not rely on any global state.

A temporary fix would be to make Popen._internal_poll and
Popen._handle_exitstatus keep a reference to the os module (just add a
default argument os=os, like sys=sys in __del__). But this is just a
hack; the real fix would be to avoid defining __del__ at all.

A patch for subprocess.py is attached.

----------
components: +Library (Lib)
keywords: +patch
nosy: +gagenellina
Added file: http://bugs.python.org/file12901/subprocess.diff

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5099>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com
[issue5099] subprocess.POpen.__del__() AttributeError (os module == None!) [ In reply to ]
Gabriel Genellina <gagsl-py2@yahoo.com.ar> added the comment:

Patch and test case against trunk

----------
versions: +Python 2.7, Python 3.0, Python 3.1
Added file: http://bugs.python.org/file12902/test_subprocess.diff

_______________________________________
Python tracker <report@bugs.python.org>
<http://bugs.python.org/issue5099>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com