[issue9940] Strange error reporting with with statement
Georg Brandl ge...@python.org added the comment: At least not without losing generality, and we don't like that. -- nosy: +georg.brandl ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9940 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9940] Strange error reporting with with statement
New submission from Antoine Pitrou pit...@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 rep...@bugs.python.org http://bugs.python.org/issue9940 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9940] Strange error reporting with with statement
Amaury Forgeot d'Arc amaur...@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 rep...@bugs.python.org http://bugs.python.org/issue9940 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9940] Strange error reporting with with statement
Benjamin Peterson benja...@python.org added the comment: I would say it's strange but correct. (and unavoidable I think) -- resolution: - invalid status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9940 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com