Message238451
| Author |
bkabrda |
| Recipients |
bkabrda |
| Date |
2015年03月18日.15:17:05 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1426691826.62.0.385210447346.issue23700@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|
History
|
|---|
| 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 |
|