[issue23700] tempfile.NamedTemporaryFile can close too early if used as iterator

STINNER Victor report at bugs.python.org
Thu Mar 19 23:47:19 CET 2015


STINNER Victor added the comment:

test_csv now fails on Windows:

http://buildbot.python.org/all/builders/x86 Windows7 3.x/builds/9421/

======================================================================
ERROR: test_read_dict_fieldnames_from_file (test.test_csv.TestDictFields)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_csv.py", line 629, in test_read_dict_fieldnames_from_file
    self.assertEqual(next(reader), {"f1": '1', "f2": '2', "f3": 'abc'})
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\csv.py", line 110, in __next__
    row = next(self.reader)
  File "D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\tempfile.py", line 431, in __iter__
    yield from iter(self.file)
ValueError: I/O operation on closed file.

----------
nosy: +haypo
resolution: fixed -> 
status: closed -> open

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


More information about the Python-bugs-list mailing list