[proxy] bugs.python.org← back | site home | direct (HTTPS) ↗ | proxy home | ◑ dark◐ light

Message 238621 - Python tracker

Message238621

Author wolma
Recipients bkabrda, ethan.furman, georg.brandl, ncoghlan, paul.moore, python-dev, sYnfo, serhiy.storchaka, vstinner, wolma
Date 2015-03-20.09:04:13
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1426842253.68.0.250287373675.issue23700@psf.upfronthosting.co.za>
In-reply-to
Content
@Serhiy

in this line of code:

reader = csv.DictReader(fileobj, fieldnames=next(csv.reader(fileobj)))

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.
History
Date User Action Args
2015-03-20 09:04:13wolmasetrecipients: + wolma, georg.brandl, paul.moore, ncoghlan, vstinner, ethan.furman, python-dev, serhiy.storchaka, bkabrda, sYnfo
2015-03-20 09:04:13wolmasetmessageid: <1426842253.68.0.250287373675.issue23700@psf.upfronthosting.co.za>
2015-03-20 09:04:13wolmalinkissue23700 messages
2015-03-20 09:04:13wolmacreate