[issue5860] TextIOWrapper: bad error reporting when write() is forbidden

Antoine Pitrou report at bugs.python.org
Mon Apr 27 23:36:56 CEST 2009


New submission from Antoine Pitrou <pitrou at free.fr>:

Opening an existing file in read-only text mode and trying to write to it:

>>> f = open("LICENSE")
>>> f.write("")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
SystemError: null argument to internal routine

Binary files get it right though:

>>> f = open("LICENSE", "rb")
>>> f.write("")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
io.UnsupportedOperation: write

----------
components: IO
messages: 86700
nosy: pitrou
priority: critical
severity: normal
status: open
title: TextIOWrapper: bad error reporting when write() is forbidden
type: behavior
versions: Python 3.1

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


More information about the Python-bugs-list mailing list