Skip to content

Commit 3c38f5a

Browse files
committed
don't compare unsigned to signed
1 parent d54249c commit 3c38f5a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Objects/codeobject.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1834,10 +1834,10 @@ code_richcompare(PyObject *self, PyObject *other, int op)
18341834
static Py_hash_t
18351835
code_hash(PyCodeObject *co)
18361836
{
1837-
Py_uhash_t res = 20221211;
1838-
#define SCRAMBLE_IN(H) do { \
1839-
res ^= (Py_uhash_t)(H); \
1840-
res *= _PyHASH_MULTIPLIER; \
1837+
Py_uhash_t uhash = 20221211;
1838+
#define SCRAMBLE_IN(H) do { \
1839+
uhash ^= (Py_uhash_t)(H); \
1840+
uhash *= _PyHASH_MULTIPLIER; \
18411841
} while (0)
18421842
#define SCRAMBLE_IN_OR_ERR(EXPR) do { \
18431843
Py_hash_t h = (EXPR); \
@@ -1865,10 +1865,10 @@ code_hash(PyCodeObject *co)
18651865
SCRAMBLE_IN(co_instr);
18661866
i += _PyOpcode_Caches[_Py_OPCODE(co_instr)];
18671867
}
1868-
if (res == -1) {
1868+
if ((Py_hash_t)uhash == -1) {
18691869
return -2;
18701870
}
1871-
return res;
1871+
return (Py_hash_t)uhash;
18721872
}
18731873

18741874

0 commit comments

Comments
 (0)