Skip to content

Commit 7546914

Browse files
authored
gh-87347: Add parenthesis around PyXXX_Check() arguments (#92815)
1 parent 484b40b commit 7546914

34 files changed

+58
-58
lines changed

Include/boolobject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ extern "C" {
99

1010
PyAPI_DATA(PyTypeObject) PyBool_Type;
1111

12-
#define PyBool_Check(x) Py_IS_TYPE(x, &PyBool_Type)
12+
#define PyBool_Check(x) Py_IS_TYPE((x), &PyBool_Type)
1313

1414
/* Py_False and Py_True are the only two bools in existence.
1515
Don't forget to apply Py_INCREF() when returning either!!! */

Include/bytearrayobject.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ PyAPI_DATA(PyTypeObject) PyByteArray_Type;
2121
PyAPI_DATA(PyTypeObject) PyByteArrayIter_Type;
2222

2323
/* Type check macros */
24-
#define PyByteArray_Check(self) PyObject_TypeCheck(self, &PyByteArray_Type)
25-
#define PyByteArray_CheckExact(self) Py_IS_TYPE(self, &PyByteArray_Type)
24+
#define PyByteArray_Check(self) PyObject_TypeCheck((self), &PyByteArray_Type)
25+
#define PyByteArray_CheckExact(self) Py_IS_TYPE((self), &PyByteArray_Type)
2626

2727
/* Direct API functions */
2828
PyAPI_FUNC(PyObject *) PyByteArray_FromObject(PyObject *);

Include/bytesobject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ PyAPI_DATA(PyTypeObject) PyBytesIter_Type;
2929

3030
#define PyBytes_Check(op) \
3131
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_BYTES_SUBCLASS)
32-
#define PyBytes_CheckExact(op) Py_IS_TYPE(op, &PyBytes_Type)
32+
#define PyBytes_CheckExact(op) Py_IS_TYPE((op), &PyBytes_Type)
3333

3434
PyAPI_FUNC(PyObject *) PyBytes_FromStringAndSize(const char *, Py_ssize_t);
3535
PyAPI_FUNC(PyObject *) PyBytes_FromString(const char *);

Include/complexobject.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ extern "C" {
1010

1111
PyAPI_DATA(PyTypeObject) PyComplex_Type;
1212

13-
#define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type)
14-
#define PyComplex_CheckExact(op) Py_IS_TYPE(op, &PyComplex_Type)
13+
#define PyComplex_Check(op) PyObject_TypeCheck((op), &PyComplex_Type)
14+
#define PyComplex_CheckExact(op) Py_IS_TYPE((op), &PyComplex_Type)
1515

1616
PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag);
1717

Include/cpython/cellobject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ typedef struct {
1515

1616
PyAPI_DATA(PyTypeObject) PyCell_Type;
1717

18-
#define PyCell_Check(op) Py_IS_TYPE(op, &PyCell_Type)
18+
#define PyCell_Check(op) Py_IS_TYPE((op), &PyCell_Type)
1919

2020
PyAPI_FUNC(PyObject *) PyCell_New(PyObject *);
2121
PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *);

Include/cpython/classobject.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ typedef struct {
1919

2020
PyAPI_DATA(PyTypeObject) PyMethod_Type;
2121

22-
#define PyMethod_Check(op) Py_IS_TYPE(op, &PyMethod_Type)
22+
#define PyMethod_Check(op) Py_IS_TYPE((op), &PyMethod_Type)
2323

2424
PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *);
2525

@@ -40,7 +40,7 @@ typedef struct {
4040

4141
PyAPI_DATA(PyTypeObject) PyInstanceMethod_Type;
4242

43-
#define PyInstanceMethod_Check(op) Py_IS_TYPE(op, &PyInstanceMethod_Type)
43+
#define PyInstanceMethod_Check(op) Py_IS_TYPE((op), &PyInstanceMethod_Type)
4444

4545
PyAPI_FUNC(PyObject *) PyInstanceMethod_New(PyObject *);
4646
PyAPI_FUNC(PyObject *) PyInstanceMethod_Function(PyObject *);

Include/cpython/code.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ struct PyCodeObject _PyCode_DEF(1);
137137

138138
PyAPI_DATA(PyTypeObject) PyCode_Type;
139139

140-
#define PyCode_Check(op) Py_IS_TYPE(op, &PyCode_Type)
140+
#define PyCode_Check(op) Py_IS_TYPE((op), &PyCode_Type)
141141
#define PyCode_GetNumFree(op) ((op)->co_nfreevars)
142142
#define _PyCode_CODE(CO) ((_Py_CODEUNIT *)(CO)->co_code_adaptive)
143143
#define _PyCode_NBYTES(CO) (Py_SIZE(CO) * (Py_ssize_t)sizeof(_Py_CODEUNIT))

Include/cpython/context.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ PyAPI_DATA(PyTypeObject) PyContextToken_Type;
1515
typedef struct _pycontexttokenobject PyContextToken;
1616

1717

18-
#define PyContext_CheckExact(o) Py_IS_TYPE(o, &PyContext_Type)
19-
#define PyContextVar_CheckExact(o) Py_IS_TYPE(o, &PyContextVar_Type)
20-
#define PyContextToken_CheckExact(o) Py_IS_TYPE(o, &PyContextToken_Type)
18+
#define PyContext_CheckExact(o) Py_IS_TYPE((o), &PyContext_Type)
19+
#define PyContextVar_CheckExact(o) Py_IS_TYPE((o), &PyContextVar_Type)
20+
#define PyContextToken_CheckExact(o) Py_IS_TYPE((o), &PyContextToken_Type)
2121

2222

2323
PyAPI_FUNC(PyObject *) PyContext_New(void);

Include/cpython/frameobject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
PyAPI_DATA(PyTypeObject) PyFrame_Type;
1010

11-
#define PyFrame_Check(op) Py_IS_TYPE(op, &PyFrame_Type)
11+
#define PyFrame_Check(op) Py_IS_TYPE((op), &PyFrame_Type)
1212

1313
PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *,
1414
PyObject *, PyObject *);

Include/cpython/funcobject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ typedef struct {
6060

6161
PyAPI_DATA(PyTypeObject) PyFunction_Type;
6262

63-
#define PyFunction_Check(op) Py_IS_TYPE(op, &PyFunction_Type)
63+
#define PyFunction_Check(op) Py_IS_TYPE((op), &PyFunction_Type)
6464

6565
PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *);
6666
PyAPI_FUNC(PyObject *) PyFunction_NewWithQualName(PyObject *, PyObject *, PyObject *);

Include/cpython/genobject.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ typedef struct {
3737

3838
PyAPI_DATA(PyTypeObject) PyGen_Type;
3939

40-
#define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type)
41-
#define PyGen_CheckExact(op) Py_IS_TYPE(op, &PyGen_Type)
40+
#define PyGen_Check(op) PyObject_TypeCheck((op), &PyGen_Type)
41+
#define PyGen_CheckExact(op) Py_IS_TYPE((op), &PyGen_Type)
4242

4343
PyAPI_FUNC(PyObject *) PyGen_New(PyFrameObject *);
4444
PyAPI_FUNC(PyObject *) PyGen_NewWithQualName(PyFrameObject *,
@@ -57,7 +57,7 @@ typedef struct {
5757
PyAPI_DATA(PyTypeObject) PyCoro_Type;
5858
PyAPI_DATA(PyTypeObject) _PyCoroWrapper_Type;
5959

60-
#define PyCoro_CheckExact(op) Py_IS_TYPE(op, &PyCoro_Type)
60+
#define PyCoro_CheckExact(op) Py_IS_TYPE((op), &PyCoro_Type)
6161
PyAPI_FUNC(PyObject *) PyCoro_New(PyFrameObject *,
6262
PyObject *name, PyObject *qualname);
6363

@@ -76,7 +76,7 @@ PyAPI_DATA(PyTypeObject) _PyAsyncGenAThrow_Type;
7676
PyAPI_FUNC(PyObject *) PyAsyncGen_New(PyFrameObject *,
7777
PyObject *name, PyObject *qualname);
7878

79-
#define PyAsyncGen_CheckExact(op) Py_IS_TYPE(op, &PyAsyncGen_Type)
79+
#define PyAsyncGen_CheckExact(op) Py_IS_TYPE((op), &PyAsyncGen_Type)
8080

8181

8282
#undef _PyGenObject_HEAD

Include/cpython/methodobject.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ typedef struct {
3131

3232
PyAPI_DATA(PyTypeObject) PyCMethod_Type;
3333

34-
#define PyCMethod_CheckExact(op) Py_IS_TYPE(op, &PyCMethod_Type)
35-
#define PyCMethod_Check(op) PyObject_TypeCheck(op, &PyCMethod_Type)
34+
#define PyCMethod_CheckExact(op) Py_IS_TYPE((op), &PyCMethod_Type)
35+
#define PyCMethod_Check(op) PyObject_TypeCheck((op), &PyCMethod_Type)
3636

3737

3838
/* Static inline functions for direct access to these values.

Include/cpython/odictobject.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ PyAPI_DATA(PyTypeObject) PyODictKeys_Type;
1818
PyAPI_DATA(PyTypeObject) PyODictItems_Type;
1919
PyAPI_DATA(PyTypeObject) PyODictValues_Type;
2020

21-
#define PyODict_Check(op) PyObject_TypeCheck(op, &PyODict_Type)
22-
#define PyODict_CheckExact(op) Py_IS_TYPE(op, &PyODict_Type)
21+
#define PyODict_Check(op) PyObject_TypeCheck((op), &PyODict_Type)
22+
#define PyODict_CheckExact(op) Py_IS_TYPE((op), &PyODict_Type)
2323
#define PyODict_SIZE(op) PyDict_GET_SIZE((op))
2424

2525
PyAPI_FUNC(PyObject *) PyODict_New(void);

Include/cpython/picklebufobject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ extern "C" {
1212

1313
PyAPI_DATA(PyTypeObject) PyPickleBuffer_Type;
1414

15-
#define PyPickleBuffer_Check(op) Py_IS_TYPE(op, &PyPickleBuffer_Type)
15+
#define PyPickleBuffer_Check(op) Py_IS_TYPE((op), &PyPickleBuffer_Type)
1616

1717
/* Create a PickleBuffer redirecting to the given buffer-enabled object */
1818
PyAPI_FUNC(PyObject *) PyPickleBuffer_FromObject(PyObject *);

Include/dictobject.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ PyAPI_DATA(PyTypeObject) PyDict_Type;
1616

1717
#define PyDict_Check(op) \
1818
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS)
19-
#define PyDict_CheckExact(op) Py_IS_TYPE(op, &PyDict_Type)
19+
#define PyDict_CheckExact(op) Py_IS_TYPE((op), &PyDict_Type)
2020

2121
PyAPI_FUNC(PyObject *) PyDict_New(void);
2222
PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key);
@@ -67,9 +67,9 @@ PyAPI_DATA(PyTypeObject) PyDictKeys_Type;
6767
PyAPI_DATA(PyTypeObject) PyDictValues_Type;
6868
PyAPI_DATA(PyTypeObject) PyDictItems_Type;
6969

70-
#define PyDictKeys_Check(op) PyObject_TypeCheck(op, &PyDictKeys_Type)
71-
#define PyDictValues_Check(op) PyObject_TypeCheck(op, &PyDictValues_Type)
72-
#define PyDictItems_Check(op) PyObject_TypeCheck(op, &PyDictItems_Type)
70+
#define PyDictKeys_Check(op) PyObject_TypeCheck((op), &PyDictKeys_Type)
71+
#define PyDictValues_Check(op) PyObject_TypeCheck((op), &PyDictValues_Type)
72+
#define PyDictItems_Check(op) PyObject_TypeCheck((op), &PyDictItems_Type)
7373
/* This excludes Values, since they are not sets. */
7474
# define PyDictViewSet_Check(op) \
7575
(PyDictKeys_Check(op) || PyDictItems_Check(op))

Include/floatobject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ extern "C" {
1414
PyAPI_DATA(PyTypeObject) PyFloat_Type;
1515

1616
#define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type)
17-
#define PyFloat_CheckExact(op) Py_IS_TYPE(op, &PyFloat_Type)
17+
#define PyFloat_CheckExact(op) Py_IS_TYPE((op), &PyFloat_Type)
1818

1919
#define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN)
2020

Include/internal/pycore_hamt.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void _PyHamt_Fini(PyInterpreterState *);
3535

3636
/* other API */
3737

38-
#define PyHamt_Check(o) Py_IS_TYPE(o, &_PyHamt_Type)
38+
#define PyHamt_Check(o) Py_IS_TYPE((o), &_PyHamt_Type)
3939

4040

4141
/* Abstract tree node. */

Include/internal/pycore_symtable.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ typedef struct _symtable_entry {
7777

7878
extern PyTypeObject PySTEntry_Type;
7979

80-
#define PySTEntry_Check(op) Py_IS_TYPE(op, &PySTEntry_Type)
80+
#define PySTEntry_Check(op) Py_IS_TYPE((op), &PySTEntry_Type)
8181

8282
extern long _PyST_GetSymbol(PySTEntryObject *, PyObject *);
8383
extern int _PyST_GetScope(PySTEntryObject *, PyObject *);

Include/internal/pycore_unionobject.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ extern "C" {
99
#endif
1010

1111
extern PyTypeObject _PyUnion_Type;
12-
#define _PyUnion_Check(op) Py_IS_TYPE(op, &_PyUnion_Type)
12+
#define _PyUnion_Check(op) Py_IS_TYPE((op), &_PyUnion_Type)
1313
extern PyObject *_Py_union_type_or(PyObject *, PyObject *);
1414

15-
#define _PyGenericAlias_Check(op) PyObject_TypeCheck(op, &Py_GenericAliasType)
15+
#define _PyGenericAlias_Check(op) PyObject_TypeCheck((op), &Py_GenericAliasType)
1616
extern PyObject *_Py_subs_parameters(PyObject *, PyObject *, PyObject *, PyObject *);
1717
extern PyObject *_Py_make_parameters(PyObject *);
1818
extern PyObject *_Py_union_args(PyObject *self);

Include/iterobject.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ PyAPI_DATA(PyTypeObject) PyCallIter_Type;
1111
extern PyTypeObject _PyAnextAwaitable_Type;
1212
#endif
1313

14-
#define PySeqIter_Check(op) Py_IS_TYPE(op, &PySeqIter_Type)
14+
#define PySeqIter_Check(op) Py_IS_TYPE((op), &PySeqIter_Type)
1515

1616
PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *);
1717

1818

19-
#define PyCallIter_Check(op) Py_IS_TYPE(op, &PyCallIter_Type)
19+
#define PyCallIter_Check(op) Py_IS_TYPE((op), &PyCallIter_Type)
2020

2121
PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *);
2222

Include/listobject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ PyAPI_DATA(PyTypeObject) PyListRevIter_Type;
2323

2424
#define PyList_Check(op) \
2525
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS)
26-
#define PyList_CheckExact(op) Py_IS_TYPE(op, &PyList_Type)
26+
#define PyList_CheckExact(op) Py_IS_TYPE((op), &PyList_Type)
2727

2828
PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size);
2929
PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *);

Include/longobject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ PyAPI_DATA(PyTypeObject) PyLong_Type;
1111

1212
#define PyLong_Check(op) \
1313
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS)
14-
#define PyLong_CheckExact(op) Py_IS_TYPE(op, &PyLong_Type)
14+
#define PyLong_CheckExact(op) Py_IS_TYPE((op), &PyLong_Type)
1515

1616
PyAPI_FUNC(PyObject *) PyLong_FromLong(long);
1717
PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLong(unsigned long);

Include/memoryobject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ PyAPI_DATA(PyTypeObject) _PyManagedBuffer_Type;
1111
#endif
1212
PyAPI_DATA(PyTypeObject) PyMemoryView_Type;
1313

14-
#define PyMemoryView_Check(op) Py_IS_TYPE(op, &PyMemoryView_Type)
14+
#define PyMemoryView_Check(op) Py_IS_TYPE((op), &PyMemoryView_Type)
1515

1616
#ifndef Py_LIMITED_API
1717
/* Get a pointer to the memoryview's private copy of the exporter's buffer. */

Include/methodobject.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ extern "C" {
1313

1414
PyAPI_DATA(PyTypeObject) PyCFunction_Type;
1515

16-
#define PyCFunction_CheckExact(op) Py_IS_TYPE(op, &PyCFunction_Type)
17-
#define PyCFunction_Check(op) PyObject_TypeCheck(op, &PyCFunction_Type)
16+
#define PyCFunction_CheckExact(op) Py_IS_TYPE((op), &PyCFunction_Type)
17+
#define PyCFunction_Check(op) PyObject_TypeCheck((op), &PyCFunction_Type)
1818

1919
typedef PyObject *(*PyCFunction)(PyObject *, PyObject *);
2020
typedef PyObject *(*_PyCFunctionFast) (PyObject *, PyObject *const *, Py_ssize_t);

Include/moduleobject.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ extern "C" {
99

1010
PyAPI_DATA(PyTypeObject) PyModule_Type;
1111

12-
#define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type)
13-
#define PyModule_CheckExact(op) Py_IS_TYPE(op, &PyModule_Type)
12+
#define PyModule_Check(op) PyObject_TypeCheck((op), &PyModule_Type)
13+
#define PyModule_CheckExact(op) Py_IS_TYPE((op), &PyModule_Type)
1414

1515
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x03030000
1616
PyAPI_FUNC(PyObject *) PyModule_NewObject(

Include/py_curses.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ typedef struct {
6464
char *encoding;
6565
} PyCursesWindowObject;
6666

67-
#define PyCursesWindow_Check(v) Py_IS_TYPE(v, &PyCursesWindow_Type)
67+
#define PyCursesWindow_Check(v) Py_IS_TYPE((v), &PyCursesWindow_Type)
6868

6969
#define PyCurses_CAPSULE_NAME "_curses._C_API"
7070

Include/pycapsule.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ PyAPI_DATA(PyTypeObject) PyCapsule_Type;
2222

2323
typedef void (*PyCapsule_Destructor)(PyObject *);
2424

25-
#define PyCapsule_CheckExact(op) Py_IS_TYPE(op, &PyCapsule_Type)
25+
#define PyCapsule_CheckExact(op) Py_IS_TYPE((op), &PyCapsule_Type)
2626

2727

2828
PyAPI_FUNC(PyObject *) PyCapsule_New(

Include/rangeobject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ PyAPI_DATA(PyTypeObject) PyRange_Type;
1919
PyAPI_DATA(PyTypeObject) PyRangeIter_Type;
2020
PyAPI_DATA(PyTypeObject) PyLongRangeIter_Type;
2121

22-
#define PyRange_Check(op) Py_IS_TYPE(op, &PyRange_Type)
22+
#define PyRange_Check(op) Py_IS_TYPE((op), &PyRange_Type)
2323

2424
#ifdef __cplusplus
2525
}

Include/setobject.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,21 @@ PyAPI_FUNC(int) PySet_Discard(PyObject *set, PyObject *key);
2020
PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set);
2121
PyAPI_FUNC(Py_ssize_t) PySet_Size(PyObject *anyset);
2222

23-
#define PyFrozenSet_CheckExact(ob) Py_IS_TYPE(ob, &PyFrozenSet_Type)
23+
#define PyFrozenSet_CheckExact(ob) Py_IS_TYPE((ob), &PyFrozenSet_Type)
2424
#define PyFrozenSet_Check(ob) \
25-
(Py_IS_TYPE(ob, &PyFrozenSet_Type) || \
25+
(Py_IS_TYPE((ob), &PyFrozenSet_Type) || \
2626
PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
2727

2828
#define PyAnySet_CheckExact(ob) \
29-
(Py_IS_TYPE(ob, &PySet_Type) || Py_IS_TYPE(ob, &PyFrozenSet_Type))
29+
(Py_IS_TYPE((ob), &PySet_Type) || Py_IS_TYPE((ob), &PyFrozenSet_Type))
3030
#define PyAnySet_Check(ob) \
31-
(Py_IS_TYPE(ob, &PySet_Type) || Py_IS_TYPE(ob, &PyFrozenSet_Type) || \
31+
(Py_IS_TYPE((ob), &PySet_Type) || Py_IS_TYPE((ob), &PyFrozenSet_Type) || \
3232
PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \
3333
PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type))
3434

3535
#define PySet_CheckExact(op) Py_IS_TYPE(op, &PySet_Type)
3636
#define PySet_Check(ob) \
37-
(Py_IS_TYPE(ob, &PySet_Type) || \
37+
(Py_IS_TYPE((ob), &PySet_Type) || \
3838
PyType_IsSubtype(Py_TYPE(ob), &PySet_Type))
3939

4040
#ifndef Py_LIMITED_API

Include/sliceobject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ typedef struct {
2828
PyAPI_DATA(PyTypeObject) PySlice_Type;
2929
PyAPI_DATA(PyTypeObject) PyEllipsis_Type;
3030

31-
#define PySlice_Check(op) Py_IS_TYPE(op, &PySlice_Type)
31+
#define PySlice_Check(op) Py_IS_TYPE((op), &PySlice_Type)
3232

3333
PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop,
3434
PyObject* step);

Include/traceback.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *);
1111

1212
/* Reveal traceback type so we can typecheck traceback objects */
1313
PyAPI_DATA(PyTypeObject) PyTraceBack_Type;
14-
#define PyTraceBack_Check(v) Py_IS_TYPE(v, &PyTraceBack_Type)
14+
#define PyTraceBack_Check(v) Py_IS_TYPE((v), &PyTraceBack_Type)
1515

1616

1717
#ifndef Py_LIMITED_API

Include/tupleobject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ PyAPI_DATA(PyTypeObject) PyTupleIter_Type;
2525

2626
#define PyTuple_Check(op) \
2727
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS)
28-
#define PyTuple_CheckExact(op) Py_IS_TYPE(op, &PyTuple_Type)
28+
#define PyTuple_CheckExact(op) Py_IS_TYPE((op), &PyTuple_Type)
2929

3030
PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size);
3131
PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *);

Include/unicodeobject.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ PyAPI_DATA(PyTypeObject) PyUnicodeIter_Type;
113113

114114
#define PyUnicode_Check(op) \
115115
PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS)
116-
#define PyUnicode_CheckExact(op) Py_IS_TYPE(op, &PyUnicode_Type)
116+
#define PyUnicode_CheckExact(op) Py_IS_TYPE((op), &PyUnicode_Type)
117117

118118
/* --- Constants ---------------------------------------------------------- */
119119

Include/weakrefobject.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ PyAPI_DATA(PyTypeObject) _PyWeakref_RefType;
1212
PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType;
1313
PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType;
1414

15-
#define PyWeakref_CheckRef(op) PyObject_TypeCheck(op, &_PyWeakref_RefType)
15+
#define PyWeakref_CheckRef(op) PyObject_TypeCheck((op), &_PyWeakref_RefType)
1616
#define PyWeakref_CheckRefExact(op) \
17-
Py_IS_TYPE(op, &_PyWeakref_RefType)
17+
Py_IS_TYPE((op), &_PyWeakref_RefType)
1818
#define PyWeakref_CheckProxy(op) \
19-
(Py_IS_TYPE(op, &_PyWeakref_ProxyType) || \
20-
Py_IS_TYPE(op, &_PyWeakref_CallableProxyType))
19+
(Py_IS_TYPE((op), &_PyWeakref_ProxyType) \
20+
|| Py_IS_TYPE((op), &_PyWeakref_CallableProxyType))
2121

2222
#define PyWeakref_Check(op) \
2323
(PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op))

0 commit comments

Comments
 (0)