This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2012年10月22日 15:46 by berker.peksag, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| resourcewarning_urllib_test.patch | berker.peksag, 2012年10月22日 15:46 | review | ||
| resourcewarning_urllib_test_v2.patch | berker.peksag, 2012年10月22日 16:24 | review | ||
| Messages (6) | |||
|---|---|---|---|
| msg173532 - (view) | Author: Berker Peksag (berker.peksag) * (Python committer) | Date: 2012年10月22日 15:46 | |
See the output: test_file_notexists (test.test_urllib.urlopen_HttpTests) ... file:///tmp/tmpmlmjhf /home/berker/hacking/cpython/Lib/test/test_urllib.py:284: ResourceWarning: unclosed file <_io.BufferedReader name='/tmp/tmpmlmjhf'> self.assertTrue(urlopen(tmp_fileurl)) ok |
|||
| msg173533 - (view) | Author: Senthil Kumaran (orsenthil) * (Python committer) | Date: 2012年10月22日 15:48 | |
thanks for the bug-report/patch. |
|||
| msg173536 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2012年10月22日 16:04 | |
You can use contextlib.closing() context manager (if urlopen() already does not return a context manager). |
|||
| msg173539 - (view) | Author: Berker Peksag (berker.peksag) * (Python committer) | Date: 2012年10月22日 16:24 | |
Thanks for the suggestion, Serhiy. Attached a new patch. |
|||
| msg173572 - (view) | Author: Senthil Kumaran (orsenthil) * (Python committer) | Date: 2012年10月23日 00:09 | |
Fixed in 478cda291bbc Berker - with urlopen(tmp_fileurl) as fobj: self.assertTrue(fobj) is enough when using context manager as the fobj gets closed automatically at exiting of context. Thanks. |
|||
| msg173580 - (view) | Author: Berker Peksag (berker.peksag) * (Python committer) | Date: 2012年10月23日 06:15 | |
You are right, thanks Senthil. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:37 | admin | set | github: 60506 |
| 2012年10月23日 06:15:33 | berker.peksag | set | messages: + msg173580 |
| 2012年10月23日 00:09:45 | orsenthil | set | status: open -> closed resolution: fixed messages: + msg173572 versions: - Python 3.3 |
| 2012年10月22日 16:24:53 | berker.peksag | set | files:
+ resourcewarning_urllib_test_v2.patch messages: + msg173539 |
| 2012年10月22日 16:04:59 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg173536 |
| 2012年10月22日 15:48:50 | orsenthil | set | nosy:
+ orsenthil messages: + msg173533 |
| 2012年10月22日 15:46:00 | berker.peksag | create | |