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: Reference count leakage in structseq_repr
Type: resource usage Stage: resolved
Components: Interpreter Core Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: serhiy.storchaka, zasdfgbnm
Priority: normal Keywords:

Created on 2019-02-26 17:09 by zasdfgbnm, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
structseq.tar.xz zasdfgbnm, 2019-02-26 17:09
Pull Requests
URL Status Linked Edit
PR 12035 merged zasdfgbnm, 2019-02-26 17:09
Messages (2)
msg336699 - (view) Author: zasdfgbnm (zasdfgbnm) * Date: 2019-02-26 17:09
In Python 2.7 structseq is not a tuple, and in `structseq_repr` a tuple is created to help extracting items. However when the check at https://github.com/python/cpython/blob/2.7/Objects/structseq.c#L268 fails, the reference count of this tuple is not decreased, causing memory leakage.

To reproduce, download the attached file, install and run the `quicktest.py` and watch the memory usage.

This bug only exists on python 2.7, because on python >3.2, no helper tuple is created.
msg336834 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2019-02-28 13:19
New changeset 69b4a17f342146d6b7a73975a37678db9916aa75 by Serhiy Storchaka (Gao, Xiang) in branch '2.7':
bpo-36126: Fix ref count leakage in structseq_repr. (GH-12035)
https://github.com/python/cpython/commit/69b4a17f342146d6b7a73975a37678db9916aa75
History
Date User Action Args
2022-04-11 14:59:11adminsetgithub: 80307
2019-02-28 13:20:19serhiy.storchakasetstatus: open -> closed
type: behavior -> resource usage
resolution: fixed
stage: resolved
2019-02-28 13:19:00serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg336834
2019-02-26 17:09:57zasdfgbnmcreate