#23700: fix/improve comment

This commit is contained in:
R David Murray 2015-03-22 12:33:46 -04:00
parent 218144a94d
commit 75ed90a4cf
1 changed files with 4 additions and 2 deletions

View File

@ -427,8 +427,10 @@ class _TemporaryFileWrapper:
# iter() doesn't use __getattr__ to find the __iter__ method # iter() doesn't use __getattr__ to find the __iter__ method
def __iter__(self): def __iter__(self):
# Don't return iter(self.file), but yield from it to avoid closing # Don't return iter(self.file), but yield from it to avoid closing
# file as long as it's being used as iterator, see issue #23000. # file as long as it's being used as iterator (see issue #23700). We
# XXX Also don't use "yield from"! # can't use 'yield from' here because iter(file) returns the file
# object itself, which has a close method, and thus the file would get
# closed when the generator is finalized, due to PEP380 semantics.
for line in self.file: for line in self.file:
yield line yield line