[New-bugs-announce] [issue9940] Strange error reporting with "with" statement

Antoine Pitrou report at bugs.python.org
Fri Sep 24 17:41:56 CEST 2010


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

Under 3.2 and 3.1:

>>> with open("foo", "wb") as x: pass
... 
>>> with open("foo", "wb") as (x, y): pass
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
io.UnsupportedOperation: read

Similar oddities under 2.7:

>>> with open("foo", "wb") as (x, y): pass
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: File not open for reading
>>> with io.open("foo", "wb") as (x, y): pass
... 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
io.UnsupportedOperation: read

----------
components: Interpreter Core, Library (Lib)
messages: 117299
nosy: benjamin.peterson, pitrou, stutzbach
priority: normal
severity: normal
status: open
title: Strange error reporting with "with" statement
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2

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


More information about the New-bugs-announce mailing list