[issue9940] Strange error reporting with "with" statement

Amaury Forgeot d'Arc report at bugs.python.org
Fri Sep 24 18:39:47 CEST 2010

Amaury Forgeot d'Arc <amauryfa at gmail.com> added the comment:

Of course, you get the same error with:

>>> f = open('foo', 'wb')
>>> x, y = f
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: File not open for reading

i.e. the tuple assignment iterates over the file, and calls readline()

nosy: +amaury.forgeotdarc

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list