[issue16597] file descriptor not being closed with context manager on IOError when device is full

Serhiy Storchaka report at bugs.python.org
Mon Dec 3 10:22:21 CET 2012


Serhiy Storchaka added the comment:

>>> f = open("/dev/full", "wb", buffering=0)
>>> f.write(b"Write to full device")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 28] No space left on device
>>> f.close()
>>> f.closed
True
>>> f = open("/dev/full", "wb")
>>> f.write(b"Write to full device")
20
>>> f.close()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 28] No space left on device
>>> f.closed
False


Python 2 has the same behavior using io.open.

----------
nosy: +serhiy.storchaka
versions: +Python 2.7, Python 3.3, Python 3.4

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


More information about the Python-bugs-list mailing list