diff options
author | R David Murray <rdmurray@bitdance.com> | 2015-03-22 16:33:46 (GMT) |
---|---|---|
committer | R David Murray <rdmurray@bitdance.com> | 2015-03-22 16:33:46 (GMT) |
commit | 75ed90a4cf07cd9236b4ed52d1c7cf09810a1749 (patch) | |
tree | 1df226bd914b8e8f74c00a0a827c27fbf094e6dd /Lib | |
parent | 218144a94d54e5219a1d63fd07775a41059afcd6 (diff) | |
download | cpython-75ed90a4cf07cd9236b4ed52d1c7cf09810a1749.zip cpython-75ed90a4cf07cd9236b4ed52d1c7cf09810a1749.tar.gz cpython-75ed90a4cf07cd9236b4ed52d1c7cf09810a1749.tar.bz2 |
#23700: fix/improve comment
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/tempfile.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py index cb18ae6..5eafc1f 100644 --- a/Lib/tempfile.py +++ b/Lib/tempfile.py @@ -427,8 +427,10 @@ class _TemporaryFileWrapper: # iter() doesn't use __getattr__ to find the __iter__ method def __iter__(self): # 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. - # XXX Also don't use "yield from"! + # file as long as it's being used as iterator (see issue #23700). We + # 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: yield line |