[New-bugs-announce] [issue28123] _PyDict_GetItem_KnownHash ignores DKIX_ERROR return

Xiang Zhang report at bugs.python.org
Tue Sep 13 05:51:18 EDT 2016


New submission from Xiang Zhang:

_PyDict_GetItem_KnownHash should handle dk_lookup return value the same as PyDict_GetItem.

BTW, it seems PyDict_GetItem can call _PyDict_GetItem_KnownHash to remove duplicate code, if you like, maybe another issue?

diff -r 6acd2b575a3c Objects/dictobject.c
--- a/Objects/dictobject.c	Tue Sep 13 07:56:45 2016 +0300
+++ b/Objects/dictobject.c	Tue Sep 13 17:46:08 2016 +0800
@@ -1370,12 +1370,12 @@
         ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, NULL);
         /* ignore errors */
         PyErr_Restore(err_type, err_value, err_tb);
-        if (ix == DKIX_EMPTY)
+        if (ix < 0)
             return NULL;
     }
     else {
         ix = (mp->ma_keys->dk_lookup)(mp, key, hash, &value_addr, NULL);
-        if (ix == DKIX_EMPTY) {
+        if (ix < 0) {
             PyErr_Clear();
             return NULL;

----------
components: Interpreter Core
messages: 276230
nosy: haypo, methane, xiang.zhang
priority: normal
severity: normal
status: open
title: _PyDict_GetItem_KnownHash ignores DKIX_ERROR return
type: behavior
versions: Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28123>
_______________________________________


More information about the New-bugs-announce mailing list