This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mvyskocil
Recipients mvyskocil
Date 2011-01-03.14:26:42
SpamBayes Score 3.5561811e-09
Marked as misclassified No
Message-id <1294064804.78.0.484906299225.issue10815@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2011-01-03 14:26:44mvyskocilsetrecipients: + mvyskocil
2011-01-03 14:26:44mvyskocilsetmessageid: <1294064804.78.0.484906299225.issue10815@psf.upfronthosting.co.za>
2011-01-03 14:26:43mvyskocillinkissue10815 messages
2011-01-03 14:26:42mvyskocilcreate