Movatterモバイル変換


[0]ホーム

URL:


homepage

Issue25935

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title:OrderedDict prevents garbage collection if a circulary referenced class is used as key
Type:behaviorStage:resolved
Components:Extension ModulesVersions:Python 3.6, Python 3.5
process
Status:closedResolution:fixed
Dependencies:Superseder:
Assigned To: serhiy.storchakaNosy List: Tim.Graham, charettes, eric.snow, python-dev, serhiy.storchaka
Priority:normalKeywords:patch

Created on2015-12-23 23:39 bycharettes, last changed2022-04-11 14:58 byadmin. This issue is nowclosed.

Files
File nameUploadedDescriptionEdit
test.pycharettes,2015-12-23 23:39Reproduction test case
odict_traverse.patchserhiy.storchaka,2015-12-28 21:49review
Messages (4)
msg256945 -(view)Author: Simon Charette (charettes)*Date: 2015-12-23 23:39
I attached a file with a reproduction test case that passes on Python 2.7 and 3.4 but fails on 3.5.0 and 3.5.1This might be solved by the improvement planed in#25410.
msg257130 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2015-12-28 21:49
An OrderedDict owns two references to every key (as a dict and from a linked list). Therefore it should visit it twice in tp_traverse.Proposed patch fixes garbage collection for OrderedDict. It also rewrites OrderedDict clearing in more reentrant form (a linked list is detached from an OrderedDict before deallocating its nodes that can trigger executing user code).
msg258590 -(view)Author: Roundup Robot (python-dev)(Python triager)Date: 2016-01-19 12:49
New changeset627575e9a7aa by Serhiy Storchaka in branch '3.5':Issue#25935: Garbage collector now breaks reference loops with OrderedDict.https://hg.python.org/cpython/rev/627575e9a7aaNew changeset5f0a08cfc4f6 by Serhiy Storchaka in branch 'default':Issue#25935: Garbage collector now breaks reference loops with OrderedDict.https://hg.python.org/cpython/rev/5f0a08cfc4f6
msg258592 -(view)Author: Serhiy Storchaka (serhiy.storchaka)*(Python committer)Date: 2016-01-19 13:50
In some cases (as in committed test) garbage collector was not able to collect a loop with OrderedDict at all.
History
DateUserActionArgs
2022-04-11 14:58:25adminsetgithub: 70123
2016-01-19 13:50:20serhiy.storchakasetstatus: open -> closed
messages: +msg258592

assignee:serhiy.storchaka
resolution: fixed
stage: patch review -> resolved
2016-01-19 12:49:09python-devsetnosy: +python-dev
messages: +msg258590
2015-12-28 21:49:14serhiy.storchakasetfiles: +odict_traverse.patch
versions: + Python 3.6
messages: +msg257130

keywords: +patch
stage: patch review
2015-12-28 13:02:36berker.peksagsetnosy: +eric.snow,serhiy.storchaka
2015-12-28 12:59:41Tim.Grahamsetnosy: +Tim.Graham
2015-12-23 23:39:59charettescreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp