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.

classification
Title: internal error on write while reading
Type: behavior Stage: needs patch
Components: Interpreter Core Versions: Python 3.1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, dsm001, pitrou
Priority: critical Keywords: patch

Created on 2009-04-25 22:45 by dsm001, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
write_while_reading_test.patch dsm001, 2009-04-25 23:15
Messages (3)
msg86562 - (view) Author: DSM (dsm001) Date: 2009-04-25 22:45
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
msg86567 - (view) Author: DSM (dsm001) Date: 2009-04-25 23:15
Added tests to py3k/Lib/test/test_file.py.  Patch against py3k trunk @
r71904.
msg87773 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2009-05-14 22:02
Fixed in r72649.
History
Date User Action Args
2022-04-11 14:56:48adminsetgithub: 50094
2009-05-14 22:02:14benjamin.petersonsetstatus: open -> closed
resolution: fixed
messages: + msg87773
2009-04-27 22:26:25ajaksu2setpriority: normal -> critical
stage: test needed -> needs patch
2009-04-25 23:15:03dsm001setfiles: + write_while_reading_test.patch
keywords: + patch
messages: + msg86567
2009-04-25 22:51:21ajaksu2setpriority: normal
type: behavior
stage: test needed
2009-04-25 22:47:50ajaksu2setnosy: + pitrou, dsm001
2009-04-25 22:47:25ajaksu2setnosy: + benjamin.peterson, - dsm001
2009-04-25 22:45:24dsm001create