[New-bugs-announce] [issue29989] subprocess.Popen does not handle file-like objects without file descriptors

Raphael Gaschignard report at bugs.python.org
Tue Apr 4 22:38:53 EDT 2017


New submission from Raphael Gaschignard:

>From the documentation of the io module:

fileno()
Return the underlying file descriptor (an integer) of the stream if it exists. An OSError is raised if the IO object does not use a file descriptor.

However, when passing a file-like object without a file descriptor (that raises OSError when calling f.fileno()) to POpen (for stdout, for example), the raised exception is not handled properly.

(However, on inspection of subprocess code, returning -1 will cause the code to handle this properly)

I'm not sure whether this is an issue in the io module documentation or in the subprocess code.


the core issue seems to be in POpen.get_handles, that seems to expect that -1 is used to signal "no file descriptor available".

----------
messages: 291151
nosy: rtpg
priority: normal
severity: normal
status: open
title: subprocess.Popen does not handle file-like objects without file descriptors
type: crash
versions: Python 3.6

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


More information about the New-bugs-announce mailing list