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: OrderedDict can set an exception in tp_clear
Type: crash Stage: resolved
Components: Interpreter Core Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: eric.snow, methane, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2018-05-31 12:08 by serhiy.storchaka, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 7349 merged serhiy.storchaka, 2018-06-03 07:48
PR 10000 merged serhiy.storchaka, 2018-10-20 07:36
PR 10001 merged serhiy.storchaka, 2018-10-20 08:31
Messages (5)
msg318287 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-05-31 12:08
The tp_clear handler of OrderedDict can set an exception when fail to allocate a nodes cache for an empty dict. An exception in tp_clear is not expected and caused a crash in the garbage collector. In the master branch it will cause just writing a traceback to stderr (see issue33622), but in any case it would be better to handle the failure locally in OrderedDict. Perhaps the cache for an empty dict is not needed.
msg318317 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-05-31 14:16
> The tp_clear handler of OrderedDict can set an exception when fail to allocate a nodes cache for an empty dict. An exception in tp_clear is not expected and caused a crash in the garbage collector.

If it's a cache, it would be better to cancel the caching, and just destroy the dictionary, no?
msg328082 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-10-19 23:27
New changeset 6f17e51345d930ccb4db306acc12b7d1f6c5e690 by Victor Stinner (Serhiy Storchaka) in branch 'master':
bpo-33712: OrderedDict only creates od_fast_nodes cache if needed (GH-7349)
https://github.com/python/cpython/commit/6f17e51345d930ccb4db306acc12b7d1f6c5e690
msg328132 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-10-20 08:24
New changeset 861d34eee345956cbb0940fa676bfb7ff492999d by Serhiy Storchaka in branch '3.7':
bpo-33712: OrderedDict only creates od_fast_nodes cache if needed (GH-7349). (GH-10000)
https://github.com/python/cpython/commit/861d34eee345956cbb0940fa676bfb7ff492999d
msg328135 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-10-20 08:47
New changeset f1b90e3922e9d218cf1f6c94ab98874c1752bdf3 by Serhiy Storchaka in branch '3.6':
bpo-33712: OrderedDict only creates od_fast_nodes cache if needed (GH-7349). (GH-10001)
https://github.com/python/cpython/commit/f1b90e3922e9d218cf1f6c94ab98874c1752bdf3
History
Date User Action Args
2022-04-11 14:59:01adminsetgithub: 77893
2018-10-20 09:10:11serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2018-10-20 08:47:11serhiy.storchakasetmessages: + msg328135
2018-10-20 08:31:38serhiy.storchakasetpull_requests: + pull_request9343
2018-10-20 08:24:11serhiy.storchakasetmessages: + msg328132
2018-10-20 07:36:18serhiy.storchakasetpull_requests: + pull_request9342
2018-10-19 23:27:50vstinnersetmessages: + msg328082
2018-06-03 07:48:26serhiy.storchakasetkeywords: + patch
stage: patch review
pull_requests: + pull_request6975
2018-05-31 14:16:40vstinnersetnosy: + vstinner
messages: + msg318317
2018-05-31 12:08:48serhiy.storchakacreate