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.move_to_end may cause crash in python 3.5
Type: crash Stage: resolved
Components: Library (Lib) Versions: Python 3.6, Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: Cruise Liu, Snivy Pang, eric.snow, python-dev, rhettinger, serhiy.storchaka
Priority: critical Keywords: patch

Created on 2015-10-14 13:20 by Cruise Liu, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
move_to_end_issue25406.patch serhiy.storchaka, 2015-10-14 15:15 review
Messages (5)
msg252991 - (view) Author: Cruise Liu (Cruise Liu) Date: 2015-10-14 13:20
Following code will crash python. Tested on linux and windows.

Python 3.5.0 (default, Sep 20 2015, 11:28:25) 
[GCC 5.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import collections
>>> x = collections.OrderedDict([ ('a', 1), ('b', 2), ('c', 3) ])
>>> x.move_to_end('c', last = False)
>>> x.move_to_end('a', last = False)
>>> x
Segmentation fault (core dumped)
msg252996 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-10-14 15:15
Here is a patch that fixes the issue.
msg252999 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2015-10-14 15:34
@Serhiy, patch LGTM.  Thanks for taking care of it.
msg253004 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2015-10-14 16:26
Thank you for your review Eric.
msg253005 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-10-14 16:27
New changeset 88e6641c3dd3 by Serhiy Storchaka in branch '3.5':
Issue #25406: Fixed a bug in C implementation of OrderedDict.move_to_end()
https://hg.python.org/cpython/rev/88e6641c3dd3

New changeset 33d53a41daeb by Serhiy Storchaka in branch 'default':
Issue #25406: Fixed a bug in C implementation of OrderedDict.move_to_end()
https://hg.python.org/cpython/rev/33d53a41daeb
History
Date User Action Args
2022-04-11 14:58:22adminsetgithub: 69592
2015-10-14 16:27:21python-devsetnosy: + python-dev
messages: + msg253005
2015-10-14 16:26:58serhiy.storchakasetstatus: open -> closed
resolution: fixed
messages: + msg253004

stage: commit review -> resolved
2015-10-14 15:34:19eric.snowsetassignee: serhiy.storchaka
2015-10-14 15:34:01eric.snowsetmessages: + msg252999
stage: patch review -> commit review
2015-10-14 15:15:42serhiy.storchakasetfiles: + move_to_end_issue25406.patch
keywords: + patch
2015-10-14 15:15:15serhiy.storchakasetmessages: + msg252996
stage: needs patch -> patch review
2015-10-14 14:40:36Snivy Pangsetnosy: + Snivy Pang
2015-10-14 14:27:14serhiy.storchakasetnosy: + eric.snow
2015-10-14 14:20:17serhiy.storchakasetpriority: normal -> critical
nosy: + rhettinger, serhiy.storchaka
stage: needs patch

versions: + Python 3.6
2015-10-14 13:20:03Cruise Liucreate