Message125175
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 |
|
Date |
User |
Action |
Args |
2011-01-03 14:26:44 | mvyskocil | set | recipients:
+ mvyskocil |
2011-01-03 14:26:44 | mvyskocil | set | messageid: <1294064804.78.0.484906299225.issue10815@psf.upfronthosting.co.za> |
2011-01-03 14:26:43 | mvyskocil | link | issue10815 messages |
2011-01-03 14:26:42 | mvyskocil | create | |
|