Serhiy Storchaka added the comment: > csv.reader(fileobj) returns the generator created by fileobj.__iter__, but no > reference to it is kept so the object gets destroyed right afterwards. This > closes the generator and because it uses yield from also the contained > subgenerator, which is the file itself.
Yes, there are no references to to the generator, created by fileobj.__iter__, but there are references to fileobj itself and to the file fileobj.file. I still don't understand why the file is closed. This looks as a bug. Committed existing fix only to make buildbots green. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23700> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com