Issue 24347: unchecked return value in C OrderedDict
Issue24347
Created on 2015-06-01 16:19 by eric.snow, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| crash-1.py | eric.snow, 2015-06-01 16:19 | |||
| issue24347.dif | eric.snow, 2015-06-02 01:08 | |||
| Messages (4) | |||
|---|---|---|---|
| msg244597 - (view) | Author: Eric Snow (eric.snow) * ![]() |
Date: 2015-06-01 16:19 | |
(from msg244574 in issue16991) crash-1.py is due to an unchecked return value from _odictnode_VALUE(). We should probably use PyDict_GetItemWithError(), also in other places. I normally try to steer clear of stylistic remarks, but the _odictnode* macros are hiding too many things. As of now, they were hiding that an assert() is always true and that a return value was unchecked. Also, they're very inconvenient in a debugger. |
|||
| msg244604 - (view) | Author: Eric Snow (eric.snow) * ![]() |
Date: 2015-06-01 17:17 | |
Regarding the macros, my intent was to limit leaking the details of the linked list implementation and make it easier to change the linked list implementation later. However, if that results in problems then I'm open to changing it. What would you recommend? |
|||
| msg244627 - (view) | Author: Eric Snow (eric.snow) * ![]() |
Date: 2015-06-02 01:08 | |
Using PyDict_GetItemWithError() is a good idea. Also, raising KeyError when the value is NULL (and no errors set) eliminates the crash. Here's a patch that fixes the problem. Unless there are any objections, I'll commit it in a couple hours. |
|||
| msg244649 - (view) | Author: Roundup Robot (python-dev) ![]() |
Date: 2015-06-02 05:06 | |
New changeset 1a7c34e23ec9 by Eric Snow in branch '3.5': Issue #24347: Set KeyError if PyDict_GetItemWithError returns NULL. https://hg.python.org/cpython/rev/1a7c34e23ec9 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:17 | admin | set | nosy:
+ larry, ned.deily github: 68535 |
| 2015-06-02 05:07:09 | eric.snow | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2015-06-02 05:06:37 | python-dev | set | nosy:
+ python-dev messages: + msg244649 |
| 2015-06-02 01:12:07 | eric.snow | link | issue24349 superseder |
| 2015-06-02 01:08:20 | eric.snow | set | files:
+ issue24347.dif messages:
+ msg244627 |
| 2015-06-01 17:23:20 | Arfrever | set | nosy:
+ Arfrever |
| 2015-06-01 17:17:54 | eric.snow | set | messages: + msg244604 |
| 2015-06-01 16:27:23 | yselivanov | set | nosy:
+ yselivanov |
| 2015-06-01 16:19:10 | eric.snow | create | |

