Skip to content

Commit b3617c8

Browse files
committed
Format the macro by PEP7
1 parent 0ad0f28 commit b3617c8

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

Modules/arraymodule.c

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -209,23 +209,27 @@ in bounds; that's the responsibility of the caller.
209209
user-defined methods (like __index__ or __float__) that might modify
210210
the array during the call.
211211
*/
212-
#define CHECK_ARRAY_BOUNDS(ap, i) \
213-
do { \
214-
if ((i) >= 0 && ((ap)->ob_item == NULL || (i) >= Py_SIZE((ap)))) { \
215-
PyErr_SetString(PyExc_IndexError, "array assignment index out of range"); \
216-
return -1; \
217-
} \
212+
#define CHECK_ARRAY_BOUNDS(OP, IDX) \
213+
do { \
214+
if ((IDX) >= 0 && ((OP)->ob_item == NULL || \
215+
(IDX) >= Py_SIZE((OP)))) { \
216+
PyErr_SetString(PyExc_IndexError, \
217+
"array assignment index out of range"); \
218+
return -1; \
219+
} \
218220
} while (0)
219221

220-
#define CHECK_ARRAY_BOUNDS_WITH_CLEANUP(ap, i, v, cleanup) \
221-
do { \
222-
if ((i) >= 0 && ((ap)->ob_item == NULL || (i) >= Py_SIZE((ap)))) { \
223-
PyErr_SetString(PyExc_IndexError, "array assignment index out of range"); \
224-
if (cleanup) { \
225-
Py_DECREF(v); \
226-
} \
227-
return -1; \
228-
} \
222+
#define CHECK_ARRAY_BOUNDS_WITH_CLEANUP(OP, IDX, VAL, CLEANUP) \
223+
do { \
224+
if ((IDX) >= 0 && ((OP)->ob_item == NULL || \
225+
(IDX) >= Py_SIZE((OP)))) { \
226+
PyErr_SetString(PyExc_IndexError, \
227+
"array assignment index out of range"); \
228+
if (CLEANUP) { \
229+
Py_DECREF(VAL); \
230+
} \
231+
return -1; \
232+
} \
229233
} while (0)
230234

231235
static PyObject *

0 commit comments

Comments
 (0)