[New-bugs-announce] [issue10815] Write to /dev/full does not raise IOError

Michal Vyskocil report at bugs.python.org
Mon Jan 3 15:26:44 CET 2011


New submission from Michal Vyskocil <mvyskocil at suse.cz>:

Write to /dev/full in python3 don't raise IOError. Python2 works as expected, the close call causes an IOError exception with no space left on device message.

$ python
Python 2.7 (r27:82500, Aug 07 2010, 16:54:59) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> f = open('/dev/full', 'w')
>>> f.write('s')
>>> f.close()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 28] No space left on device

However using python3 I don't get an IOError after close
$ python3
Python 3.1.2 (r312:79147, Nov 20 2010, 11:33:28) 
[GCC 4.5.1 20101001 [gcc-4_5-branch revision 164883]] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> f = open('/dev/full', 'w')
>>> f.write('s')
1
>>> f.close()

The only one way how to raise IOError in python3 is call f.flush()

...
>>> f.write('s')
1
>>> f.flush()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 28] No space left on device

Documentation of io.IOBase.close() [1] said Flush and close this stream, so one should expect calls f.flush();f.close() will be the same as plain f.close().

[1] http://docs.python.org/py3k/library/io.html

----------
components: IO
messages: 125175
nosy: mvyskocil
priority: normal
severity: normal
status: open
title: Write to /dev/full does not raise IOError
versions: Python 3.1

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


More information about the New-bugs-announce mailing list