File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -55,15 +55,18 @@ PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *);
5555
5656/* Macro, trading safety for speed */
5757#ifndef Py_LIMITED_API
58- #define PyTuple_GET_ITEM (op , i ) (((PyTupleObject *)(op))->ob_item[i])
59- #define PyTuple_GET_SIZE (op ) (assert(PyTuple_Check(op)),Py_SIZE(op))
58+ /* Cast argument to PyTupleObject* type. */
59+ #define _PyTuple_CAST (op ) ((PyTupleObject *)(op))
60+
61+ #define PyTuple_GET_ITEM (op , i ) (_PyTuple_CAST(op)->ob_item[i])
62+ #define PyTuple_GET_SIZE (op ) (assert(PyTuple_Check(op)), Py_SIZE(op))
6063
6164#ifdef Py_BUILD_CORE
62- # define _PyTuple_ITEMS (op ) ((((PyTupleObject *)( op)) ->ob_item) )
65+ # define _PyTuple_ITEMS (op ) (_PyTuple_CAST( op)->ob_item)
6366#endif
6467
6568/* Macro, *only* to be used to fill in brand new tuples */
66- #define PyTuple_SET_ITEM (op , i , v ) (((PyTupleObject *)(op) )->ob_item[i] = v)
69+ #define PyTuple_SET_ITEM (op , i , v ) (_PyTuple_CAST(op )->ob_item[i] = v)
6770#endif
6871
6972PyAPI_FUNC (int ) PyTuple_ClearFreeList (void );
You can’t perform that action at this time.
0 commit comments