Skip to content

Commit 555ca98

Browse files
committed
Modules/_testcapi/monitoring.c: protect macros expansion via do { ... } while (0) constructions
1 parent 311819a commit 555ca98

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Modules/_testcapi/monitoring.c

+9-4
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,15 @@ static PyTypeObject PyCodeLike_Type = {
105105
.tp_str = (reprfunc) CodeLike_str,
106106
};
107107

108-
#define RAISE_UNLESS_CODELIKE(v) if (!Py_IS_TYPE((v), &PyCodeLike_Type)) { \
109-
PyErr_Format(PyExc_TypeError, "expected a code-like, got %s", Py_TYPE(v)->tp_name); \
110-
return NULL; \
111-
}
108+
#define RAISE_UNLESS_CODELIKE(v) \
109+
do { \
110+
if (!Py_IS_TYPE((v), &PyCodeLike_Type)) { \
111+
PyErr_Format(PyExc_TypeError, \
112+
"expected a code-like, got %s", \
113+
Py_TYPE(v)->tp_name); \
114+
return NULL; \
115+
} \
116+
} while (0)
112117

113118
/*******************************************************************/
114119

0 commit comments

Comments
 (0)