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.

Author xiang.zhang
Recipients methane, vstinner, xiang.zhang
Date 2016-09-13.09:51:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1473760278.9.0.335020145509.issue28123@psf.upfronthosting.co.za>
In-reply-to
Content
_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;
History
Date User Action Args
2016-09-13 09:51:18xiang.zhangsetrecipients: + xiang.zhang, vstinner, methane
2016-09-13 09:51:18xiang.zhangsetmessageid: <1473760278.9.0.335020145509.issue28123@psf.upfronthosting.co.za>
2016-09-13 09:51:18xiang.zhanglinkissue28123 messages
2016-09-13 09:51:18xiang.zhangcreate