Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 23f9f66

Browse files
committed
Assert that op != NULL in _PyTuple_RESET_HASH_CACHE
1 parent 224bef2 commit 23f9f66

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Include/internal/pycore_tuple.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,11 @@ typedef struct {
3333
PyTupleObject *it_seq; /* Set to NULL when iterator is exhausted */
3434
} _PyTupleIterObject;
3535

36-
#define _PyTuple_RESET_HASH_CACHE(op) (_PyTuple_CAST(op)->ob_hash = -1)
36+
#define _PyTuple_RESET_HASH_CACHE(op) \
37+
do { \
38+
assert(op != NULL); \
39+
_PyTuple_CAST(op)->ob_hash = -1; \
40+
} while (0)
3741

3842
/*
3943
bpo-42536: If reusing a tuple object, this should be called to re-track it

0 commit comments

Comments
 (0)