Skip to content

Commit

Permalink
SCRAMBLE_IN_HASH macro
Browse files Browse the repository at this point in the history
  • Loading branch information
sweeneyde committed Dec 19, 2022
1 parent b2975bc commit 2014fb1
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions Objects/codeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1847,20 +1847,20 @@ code_hash(PyCodeObject *co)
uhash ^= (Py_uhash_t)(H); \
uhash *= _PyHASH_MULTIPLIER; \
} while (0)
#define SCRAMBLE_IN_OR_ERR(EXPR) do { \
Py_hash_t h = (EXPR); \
if (h == -1) { \
return -1; \
} \
SCRAMBLE_IN(h); \
#define SCRAMBLE_IN_HASH(EXPR) do { \
Py_hash_t h = PyObject_Hash(EXPR); \
if (h == -1) { \
return -1; \
} \
SCRAMBLE_IN(h); \
} while (0)

SCRAMBLE_IN_OR_ERR(PyObject_Hash(co->co_name));
SCRAMBLE_IN_OR_ERR(PyObject_Hash(co->co_consts));
SCRAMBLE_IN_OR_ERR(PyObject_Hash(co->co_names));
SCRAMBLE_IN_OR_ERR(PyObject_Hash(co->co_localsplusnames));
SCRAMBLE_IN_OR_ERR(PyObject_Hash(co->co_linetable));
SCRAMBLE_IN_OR_ERR(PyObject_Hash(co->co_exceptiontable));
SCRAMBLE_IN_HASH(co->co_name);
SCRAMBLE_IN_HASH(co->co_consts);
SCRAMBLE_IN_HASH(co->co_names);
SCRAMBLE_IN_HASH(co->co_localsplusnames);
SCRAMBLE_IN_HASH(co->co_linetable);
SCRAMBLE_IN_HASH(co->co_exceptiontable);
SCRAMBLE_IN(co->co_argcount);
SCRAMBLE_IN(co->co_posonlyargcount);
SCRAMBLE_IN(co->co_kwonlyargcount);
Expand Down

0 comments on commit 2014fb1

Please sign in to comment.