[issue5380] array.fromfile() on master pty raises IOError when slave pty device is closed

Zac Medico report at bugs.python.org
Fri Feb 27 09:03:34 CET 2009


New submission from Zac Medico <zmedico at gentoo.org>:

With python-3.0, array.fromfile() raises an IOError when reading from a
master pty device after the slave device has been closed. This causes
remaining data that had been written to the slave device to be lost. I
have observed this problem with python-3.0.1 on linux (I get the same
result with or without the patch from issue 5334). The traceback
produced by the attached test case looks like this:

    Traceback (most recent call last):
    File "./fromfile_pty_ioerror.py", line 26, in <module>
        buf.fromfile(master_file, bufsize)
    File "/usr/lib/python3.0/io.py", line 918, in read
        return self._read_unlocked(n)
    File "/usr/lib/python3.0/io.py", line 952, in _read_unlocked
        chunk = self.raw.read(wanted)
    IOError: [Errno 5] Input/output error

With python-2.x, the remaining data is appended to the array and an
EOFError is raised like one would expect.

----------
components: Library (Lib)
files: fromfile_pty_ioerror.py
messages: 82824
nosy: zmedico
severity: normal
status: open
title: array.fromfile() on master pty raises IOError when slave pty device is closed
type: behavior
versions: Python 3.0
Added file: http://bugs.python.org/file13200/fromfile_pty_ioerror.py

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


More information about the Python-bugs-list mailing list