Message238451
This bug is very similar to #18879, the only difference is that _TemporaryFileWrapper.__iter__ is the problem (in #18879, __getattr__ was fixed, but __iter__ was not). The real world use case that helped me find this bug is at the bottom of this report, this is a simple reproducer:
>>> import tempfile
>>> for l in tempfile.NamedTemporaryFile(mode='a+b'):
... print(l)
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: readline of closed file
I'm attaching a patch that fixes this (+ testcase).
Note: I actually discovered this while using
>>> from urllib.request import urlopen
>>> for l in urlopen('ftp://<some_ftp>'):
... print(l)
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: readline of closed file
Opening FTP uses urllib.response, which in turn uses tempfile._TemporaryFileWrapper, which makes this example fail. |
|
Date |
User |
Action |
Args |
2015-03-18 15:17:06 | bkabrda | set | recipients:
+ bkabrda |
2015-03-18 15:17:06 | bkabrda | set | messageid: <1426691826.62.0.385210447346.issue23700@psf.upfronthosting.co.za> |
2015-03-18 15:17:06 | bkabrda | link | issue23700 messages |
2015-03-18 15:17:06 | bkabrda | create | |
|