[New-bugs-announce] [issue29174] 'NoneType' object is not callable in subprocess.py

ita1024 report at bugs.python.org
Fri Jan 6 02:48:58 EST 2017


New submission from ita1024:

Please try the attached testcase with `python3.6 test.py`; Python 3.6 displays unnecessary warnings of the following form:

$ ../test.py
Exception ignored in: <bound method Popen.__del__ of <subprocess.Popen object at 0x7fe6744fc5c0>>
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/subprocess.py", line 761, in __del__
TypeError: 'NoneType' object is not callable
Exception ignored in: <bound method Popen.__del__ of <subprocess.Popen object at 0x7fe6744fc550>>
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/subprocess.py", line 761, in __del__

These warnings appear because of the line "warnings.warn" recently added in subprocess.Popen.__del__:
1. The call to warnings.warn is not usable during interpreter shutdown (and running `python -W ignore test.py` has no effect)
2. Calling "process.terminate()" or "process.kill()" at in the testcase or in an atexit handler would not get rid of the warning, one must set the return code on the Popen object
3. The warning can show up in existing code that has absolutely no zombie problems.

I suggest to revert the recently added warning from subprocess.py:

"""
@@ -754,11 +995,6 @@
         if not self._child_created:
             # We didn't get to successfully create a child process.
             return
-        if self.returncode is None:
-            # Not reading subprocess exit status creates a zombi process which
-            # is only destroyed at the parent python process exit
-            warnings.warn("subprocess %s is still running" % self.pid,
-                          ResourceWarning, source=self)
         # In case the child hasn't been waited on, check if it's done.
         self._internal_poll(_deadstate=_maxsize)
         if self.returncode is None and _active is not None:
"""

----------
components: Library (Lib)
files: test.py
messages: 284798
nosy: ita1024
priority: normal
severity: normal
status: open
title: 'NoneType' object is not callable in subprocess.py
type: behavior
versions: Python 3.6
Added file: http://bugs.python.org/file46171/test.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29174>
_______________________________________


More information about the New-bugs-announce mailing list