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: Certain errors during IMPORT_STAR can leak a reference
Type: resource usage Stage: resolved
Components: Interpreter Core Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Peter Cawley, berker.peksag, mbussonn, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2017-02-25 21:26 by Peter Cawley, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue29655-2.7.patch serhiy.storchaka, 2017-02-28 06:13
Pull Requests
URL Status Linked Edit
PR 301 merged mbussonn, 2017-02-26 01:28
PR 348 merged berker.peksag, 2017-02-27 16:43
PR 349 merged berker.peksag, 2017-02-27 16:45
PR 510 merged serhiy.storchaka, 2017-03-06 11:00
Messages (8)
msg288582 - (view) Author: Peter Cawley (Peter Cawley) Date: 2017-02-25 21:26
In the implementation of the IMPORT_STAR opcode, if the call to PyFrame_FastToLocalsWithError fails, or f_locals is NULL, then control flow jumps to the error handler without performing a decref on the "from" variable. As the "from" variable is initialised by POPping from the stack, the reference is leaked.
msg288664 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-02-27 19:11
It looks to me that 2.7 has this bug.
msg288665 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2017-02-27 19:29
I ignored 2.7 because you know... it's 2.7 :) And you said [1] that it doesn't have a big effect on real applications.

[1] https://github.com/python/cpython/pull/301#issuecomment-282789185
msg288694 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-02-28 06:13
But it is *very easy* to fix this bug in 2.7.
msg290263 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-03-24 22:41
New changeset 9fbb65e6464b56c6d677090e185c9fe16a80ed96 by Serhiy Storchaka in branch '2.7':
bpo-29655: Fixed possible reference leaks in `import *`. (#301) (#510)
https://github.com/python/cpython/commit/9fbb65e6464b56c6d677090e185c9fe16a80ed96
msg290362 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2017-03-24 23:36
New changeset 0dadf56737f591c83d18db5e445960d39448583e by Berker Peksag in branch '3.5':
bpo-29655: Fixed possible reference leaks in `import *`. (#301) (#349)
https://github.com/python/cpython/commit/0dadf56737f591c83d18db5e445960d39448583e
msg290363 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2017-03-24 23:36
New changeset 7accf2033d03025cc5324f8b9d22582bca3623e9 by Berker Peksag in branch '3.6':
bpo-29655: Fixed possible reference leaks in `import *`. (#301) (#348)
https://github.com/python/cpython/commit/7accf2033d03025cc5324f8b9d22582bca3623e9
msg290399 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017-03-24 23:45
New changeset 160edb43571311a3785785c1dfa784afc52d87be by Serhiy Storchaka (Matthias Bussonnier) in branch 'master':
bpo-29655: Fixed possible reference leaks in `import *`. (#301)
https://github.com/python/cpython/commit/160edb43571311a3785785c1dfa784afc52d87be
History
Date User Action Args
2022-04-11 14:58:43adminsetgithub: 73841
2017-03-24 23:45:06serhiy.storchakasetmessages: + msg290399
2017-03-24 23:36:25berker.peksagsetmessages: + msg290363
2017-03-24 23:36:11berker.peksagsetmessages: + msg290362
2017-03-24 22:41:14serhiy.storchakasetmessages: + msg290263
2017-03-15 10:49:37berker.peksagsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2017-03-06 11:00:19serhiy.storchakasetpull_requests: + pull_request419
2017-02-28 06:13:33serhiy.storchakasetstatus: closed -> open
files: + issue29655-2.7.patch

versions: + Python 2.7, - Python 3.5, Python 3.6, Python 3.7
keywords: + patch
resolution: fixed -> (no value)
messages: + msg288694
stage: resolved -> patch review
2017-02-27 19:29:53berker.peksagsetnosy: + berker.peksag
messages: + msg288665
2017-02-27 19:11:26serhiy.storchakasetmessages: + msg288664
2017-02-27 18:25:59berker.peksagsetstatus: open -> closed
stage: needs patch -> resolved
resolution: fixed
versions: - Python 2.7
2017-02-27 16:45:34berker.peksagsetpull_requests: + pull_request301
2017-02-27 16:43:38berker.peksagsetpull_requests: + pull_request300
2017-02-26 01:28:54mbussonnsetpull_requests: + pull_request267
2017-02-25 21:49:58serhiy.storchakasetnosy: + serhiy.storchaka
stage: needs patch
type: behavior -> resource usage

versions: + Python 2.7, Python 3.5, Python 3.6
2017-02-25 21:49:19mbussonnsetnosy: + mbussonn
2017-02-25 21:26:53Peter Cawleycreate