[New-bugs-announce] [issue5844] internal error on write while reading

DSM report at bugs.python.org
Sun Apr 26 00:45:25 CEST 2009


New submission from DSM <dsm001 at users.sourceforge.net>:

Inspired by http://bugs.python.org/issue1653416 , I tried writing to a
file opened for reading in 3.1 trunk, and found:

Python 3.1a2+ (py3k:71900M, Apr 25 2009, 16:12:31) 
[GCC 4.0.1 (Apple Computer, Inc. build 5363)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> fp = open('/etc/passwd')
>>> fp.write('test')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: null argument to internal routine
>>> print('test',file=fp)        
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: null argument to internal routine

but binary mode gives:

>>> fp = open('/etc/passwd','rb')
>>> fp.write(b'test')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
io.UnsupportedOperation: write
>>> print(b'test',file=fp)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
io.UnsupportedOperation: write

----------
components: Interpreter Core
messages: 86562
nosy: dsm001
severity: normal
status: open
title: internal error on write while reading
versions: Python 3.1

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


More information about the New-bugs-announce mailing list