summaryrefslogtreecommitdiffstats
path: root/Lib/tempfile.py
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2015-03-22 16:34:50 (GMT)
committerR David Murray <rdmurray@bitdance.com>2015-03-22 16:34:50 (GMT)
commit5d06c74f41a976cd042bfbb52f2f6762a44e1e26 (patch)
tree38fb3f1c7adf4e29a264bd740944da2e06d2dda0 /Lib/tempfile.py
parenta4d4dd3a9dff1aaf24a3d9df301fef614625eee9 (diff)
parent75ed90a4cf07cd9236b4ed52d1c7cf09810a1749 (diff)
downloadcpython-5d06c74f41a976cd042bfbb52f2f6762a44e1e26.zip
cpython-5d06c74f41a976cd042bfbb52f2f6762a44e1e26.tar.gz
cpython-5d06c74f41a976cd042bfbb52f2f6762a44e1e26.tar.bz2
Merge: #23700: fix/improve comment
Diffstat (limited to 'Lib/tempfile.py')
-rw-r--r--Lib/tempfile.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/tempfile.py b/Lib/tempfile.py
index 07033c6..4543d3f 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