mirror of https://github.com/python/cpython
gh-121266: Change dict check_lookup() return type to int (#121581)
This commit is contained in:
parent
b826e459ca
commit
51da3dfbf3
|
@ -1050,7 +1050,7 @@ lookdict_index(PyDictKeysObject *k, Py_hash_t hash, Py_ssize_t index)
|
|||
|
||||
static inline Py_ALWAYS_INLINE Py_ssize_t
|
||||
do_lookup(PyDictObject *mp, PyDictKeysObject *dk, PyObject *key, Py_hash_t hash,
|
||||
Py_ssize_t (*check_lookup)(PyDictObject *, PyDictKeysObject *, void *, Py_ssize_t ix, PyObject *key, Py_hash_t))
|
||||
int (*check_lookup)(PyDictObject *, PyDictKeysObject *, void *, Py_ssize_t ix, PyObject *key, Py_hash_t))
|
||||
{
|
||||
void *ep0 = _DK_ENTRIES(dk);
|
||||
size_t mask = DK_MASK(dk);
|
||||
|
@ -1060,7 +1060,7 @@ do_lookup(PyDictObject *mp, PyDictKeysObject *dk, PyObject *key, Py_hash_t hash,
|
|||
for (;;) {
|
||||
ix = dictkeys_get_index(dk, i);
|
||||
if (ix >= 0) {
|
||||
Py_ssize_t cmp = check_lookup(mp, dk, ep0, ix, key, hash);
|
||||
int cmp = check_lookup(mp, dk, ep0, ix, key, hash);
|
||||
if (cmp < 0) {
|
||||
return cmp;
|
||||
} else if (cmp) {
|
||||
|
@ -1076,7 +1076,7 @@ do_lookup(PyDictObject *mp, PyDictKeysObject *dk, PyObject *key, Py_hash_t hash,
|
|||
// Manual loop unrolling
|
||||
ix = dictkeys_get_index(dk, i);
|
||||
if (ix >= 0) {
|
||||
Py_ssize_t cmp = check_lookup(mp, dk, ep0, ix, key, hash);
|
||||
int cmp = check_lookup(mp, dk, ep0, ix, key, hash);
|
||||
if (cmp < 0) {
|
||||
return cmp;
|
||||
} else if (cmp) {
|
||||
|
@ -1092,7 +1092,7 @@ do_lookup(PyDictObject *mp, PyDictKeysObject *dk, PyObject *key, Py_hash_t hash,
|
|||
Py_UNREACHABLE();
|
||||
}
|
||||
|
||||
static inline Py_ALWAYS_INLINE Py_ssize_t
|
||||
static inline Py_ALWAYS_INLINE int
|
||||
compare_unicode_generic(PyDictObject *mp, PyDictKeysObject *dk,
|
||||
void *ep0, Py_ssize_t ix, PyObject *key, Py_hash_t hash)
|
||||
{
|
||||
|
@ -1127,7 +1127,7 @@ unicodekeys_lookup_generic(PyDictObject *mp, PyDictKeysObject* dk, PyObject *key
|
|||
return do_lookup(mp, dk, key, hash, compare_unicode_generic);
|
||||
}
|
||||
|
||||
static inline Py_ALWAYS_INLINE Py_ssize_t
|
||||
static inline Py_ALWAYS_INLINE int
|
||||
compare_unicode_unicode(PyDictObject *mp, PyDictKeysObject *dk,
|
||||
void *ep0, Py_ssize_t ix, PyObject *key, Py_hash_t hash)
|
||||
{
|
||||
|
@ -1148,7 +1148,7 @@ unicodekeys_lookup_unicode(PyDictKeysObject* dk, PyObject *key, Py_hash_t hash)
|
|||
return do_lookup(NULL, dk, key, hash, compare_unicode_unicode);
|
||||
}
|
||||
|
||||
static inline Py_ALWAYS_INLINE Py_ssize_t
|
||||
static inline Py_ALWAYS_INLINE int
|
||||
compare_generic(PyDictObject *mp, PyDictKeysObject *dk,
|
||||
void *ep0, Py_ssize_t ix, PyObject *key, Py_hash_t hash)
|
||||
{
|
||||
|
@ -1343,8 +1343,8 @@ ensure_shared_on_resize(PyDictObject *mp)
|
|||
|
||||
#ifdef Py_GIL_DISABLED
|
||||
|
||||
static inline Py_ALWAYS_INLINE
|
||||
Py_ssize_t compare_unicode_generic_threadsafe(PyDictObject *mp, PyDictKeysObject *dk,
|
||||
static inline Py_ALWAYS_INLINE int
|
||||
compare_unicode_generic_threadsafe(PyDictObject *mp, PyDictKeysObject *dk,
|
||||
void *ep0, Py_ssize_t ix, PyObject *key, Py_hash_t hash)
|
||||
{
|
||||
PyDictUnicodeEntry *ep = &((PyDictUnicodeEntry *)ep0)[ix];
|
||||
|
@ -1386,7 +1386,7 @@ unicodekeys_lookup_generic_threadsafe(PyDictObject *mp, PyDictKeysObject* dk, Py
|
|||
return do_lookup(mp, dk, key, hash, compare_unicode_generic_threadsafe);
|
||||
}
|
||||
|
||||
static inline Py_ALWAYS_INLINE Py_ssize_t
|
||||
static inline Py_ALWAYS_INLINE int
|
||||
compare_unicode_unicode_threadsafe(PyDictObject *mp, PyDictKeysObject *dk,
|
||||
void *ep0, Py_ssize_t ix, PyObject *key, Py_hash_t hash)
|
||||
{
|
||||
|
@ -1420,8 +1420,8 @@ unicodekeys_lookup_unicode_threadsafe(PyDictKeysObject* dk, PyObject *key, Py_ha
|
|||
return do_lookup(NULL, dk, key, hash, compare_unicode_unicode_threadsafe);
|
||||
}
|
||||
|
||||
static inline Py_ALWAYS_INLINE
|
||||
Py_ssize_t compare_generic_threadsafe(PyDictObject *mp, PyDictKeysObject *dk,
|
||||
static inline Py_ALWAYS_INLINE int
|
||||
compare_generic_threadsafe(PyDictObject *mp, PyDictKeysObject *dk,
|
||||
void *ep0, Py_ssize_t ix, PyObject *key, Py_hash_t hash)
|
||||
{
|
||||
PyDictKeyEntry *ep = &((PyDictKeyEntry *)ep0)[ix];
|
||||
|
|
Loading…
Reference in New Issue