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.

classification
Title: Leak in TextIOWrapper.tell()
Type: resource usage Stage: resolved
Components: Extension Modules Versions: Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: benjamin.peterson, pitrou, python-dev, serhiy.storchaka, stutzbach, vstinner
Priority: normal Keywords: patch

Created on 2015-03-26 13:04 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue23785.patch serhiy.storchaka, 2015-03-26 13:10
Messages (7)
msg239327 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-03-26 13:04
If an exception was raised in TextIOWrapper.tell() and then restoring state is failed, original exception is lost and leaked.
msg239328 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-03-26 13:10
Proposed patch chain original exception to the exception raised by setstate(saved_state). This matches the behavior of Python implementation.
msg239331 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2015-03-26 13:56
lgtm with a test
msg239332 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-03-26 14:07
It would be not easy to reproduce without special broken decoder.
msg239333 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2015-03-26 14:07
How did you notice it, btw?
msg239334 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-03-26 14:36
Just reading the code that uses PyErr_Restore(). I found 3 issues and may be the fourth in sqlite (it is more complicate than other 3).
msg239573 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-03-30 07:01
New changeset 442ebebad516 by Serhiy Storchaka in branch '3.4':
Issue #23785: Fixed memory leak in TextIOWrapper.tell() in rare circumstances.
https://hg.python.org/cpython/rev/442ebebad516

New changeset 2fcd99929dba by Serhiy Storchaka in branch 'default':
Issue #23785: Fixed memory leak in TextIOWrapper.tell() in rare circumstances.
https://hg.python.org/cpython/rev/2fcd99929dba

New changeset 12d3eec72f9e by Serhiy Storchaka in branch '2.7':
Issue #23785: Fixed memory leak in TextIOWrapper.tell() in rare circumstances.
https://hg.python.org/cpython/rev/12d3eec72f9e
History
Date User Action Args
2022-04-11 14:58:14adminsetgithub: 67973
2015-03-30 07:02:35serhiy.storchakasetstatus: open -> closed
assignee: serhiy.storchaka
resolution: fixed
stage: patch review -> resolved
2015-03-30 07:01:47python-devsetnosy: + python-dev
messages: + msg239573
2015-03-26 14:36:58serhiy.storchakasetmessages: + msg239334
2015-03-26 14:07:59benjamin.petersonsetmessages: + msg239333
2015-03-26 14:07:01serhiy.storchakasetmessages: + msg239332
2015-03-26 13:56:03benjamin.petersonsetmessages: + msg239331
2015-03-26 13:10:54serhiy.storchakasetfiles: + issue23785.patch
keywords: + patch
2015-03-26 13:10:27serhiy.storchakasetmessages: + msg239328
stage: patch review
2015-03-26 13:04:41serhiy.storchakacreate