New submission from DSM <dsm...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue5844>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to