Issue21310
Created on 2014-04-19 03:23 by martin.panter, last changed 2014-06-11 04:20 by python-dev. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| io_open_resource_warning.patch | serhiy.storchaka, 2014-05-29 19:28 | review | ||
| Messages (6) | |||
|---|---|---|---|
| msg216838 - (view) | Author: Martin Panter (martin.panter) * | Date: 2014-04-19 03:23 | |
>>> f = open("/dev/stdout", "w+b") # Or any non-seekable file, pipe, etc
__main__:1: ResourceWarning: unclosed file <_io.FileIO name='/dev/stdout' mode='rb+'>
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
io.UnsupportedOperation: File or stream is not seekable.
It is mainly just the annoyance of the ResourceWarning, so nothing major. I think this was previously identified in Issue 18116, but it looks like that bug was side-stepped by removing an equivalent fdopen() call.
No ResourceWarning happens with an unbuffered file. I haven’t looked at the code but I guess the UnsupportedOperation might only be raised after trying to wrap the open FileIO object in a BufferedWriter object.
|
|||
| msg219153 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2014-05-26 11:26 | |
See also issue20074. |
|||
| msg219361 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2014-05-29 19:28 | |
Here is a patch which fixes warnings. |
|||
| msg220087 - (view) | Author: Roundup Robot (python-dev) | Date: 2014-06-09 10:52 | |
New changeset 1e30ecbfe181 by Serhiy Storchaka in branch '2.7': Issue #21310: Fixed possible resource leak in failed open(). http://hg.python.org/cpython/rev/1e30ecbfe181 New changeset 17e7934905ab by Serhiy Storchaka in branch '3.4': Issue #21310: Fixed possible resource leak in failed open(). http://hg.python.org/cpython/rev/17e7934905ab New changeset 9c724c428e1f by Serhiy Storchaka in branch 'default': Issue #21310: Fixed possible resource leak in failed open(). http://hg.python.org/cpython/rev/9c724c428e1f |
|||
| msg220104 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2014-06-09 17:42 | |
Thanks Victor for the review. Thanks Martin for the report. |
|||
| msg220233 - (view) | Author: Roundup Robot (python-dev) | Date: 2014-06-11 04:20 | |
New changeset a98fd4eeed40 by Serhiy Storchaka in branch '3.4': PyErr_NormalizeException doesn't like being called with an exception set http://hg.python.org/cpython/rev/a98fd4eeed40 New changeset 55c50c570098 by Serhiy Storchaka in branch 'default': PyErr_NormalizeException doesn't like being called with an exception set http://hg.python.org/cpython/rev/55c50c570098 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2014-06-11 04:20:06 | python-dev | set | messages: + msg220233 |
| 2014-06-09 17:42:46 | serhiy.storchaka | set | status: open -> closed resolution: fixed messages: + msg220104 stage: patch review -> resolved |
| 2014-06-09 10:52:08 | python-dev | set | nosy:
+ python-dev messages: + msg220087 |
| 2014-05-29 19:28:05 | serhiy.storchaka | set | files:
+ io_open_resource_warning.patch versions: + Python 2.7, Python 3.5 messages: + msg219361 assignee: serhiy.storchaka |
| 2014-05-26 11:26:41 | serhiy.storchaka | set | messages: + msg219153 |
| 2014-05-26 10:28:18 | ezio.melotti | set | nosy:
+ pitrou, vstinner, serhiy.storchaka type: behavior |
| 2014-04-19 03:23:49 | martin.panter | create | |