New submission from Antoine Pitrou <[email protected]>:

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 <[email protected]>
<http://bugs.python.org/issue9940>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to