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 <rep...@bugs.python.org> <http://bugs.python.org/issue28123> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com