[New-bugs-announce] [issue12695] subprocess.Popen: OSError: [Errno 9] Bad file descriptor

Martin von Gagern report at bugs.python.org
Fri Aug 5 12:53:43 CEST 2011


New submission from Martin von Gagern <Martin.vGagern at gmx.net>:

suprocess.Popen on POSIX (using _posixsubprocess Module) has a good chance of repeatedly closing the same file descriptor if the descriptor for stdin is also used for stdout and/or stderr. Only stdout and stderr are checked for equality with one another.

This breaks webbrowser.open for me, as the browser remote has all three descriptors redirected from/to /dev/null. This breaks "pydoc -p". I've taken this scenario and turned it into a unit test, which you find attached together with a proposed fix.

On my currently installed Python 3.2, the unit tests results in this traceback (and two more like it for other test classes):

ERROR: test_inouterr_fileobj (__main__.ProcessTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "Lib/test/test_subprocess.py", line 630, in test_inouterr_fileobj
    stderr = devnull)
  File "/usr/lib64/python3.2/subprocess.py", line 736, in __init__
    restore_signals, start_new_session)
  File "/usr/lib64/python3.2/subprocess.py", line 1330, in _execute_child
    raise child_exception_type(errno_num, err_msg)
OSError: [Errno 9] Bad file descriptor

----------
components: Library (Lib)
files: subprocess.patch
keywords: patch
messages: 141653
nosy: gagern
priority: normal
severity: normal
status: open
title: subprocess.Popen: OSError: [Errno 9] Bad file descriptor
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file22836/subprocess.patch

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


More information about the New-bugs-announce mailing list