Skip to content

Commit 8863b2e

Browse files
unnecessary, but pretty
1 parent a1655f1 commit 8863b2e

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

Objects/codeobject.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ intern_strings(PyObject *tuple)
196196
return 0;
197197
}
198198

199+
#define _constants_tuple_modified(modified) if (modified) *modified = 1
200+
199201
/* Intern constants. In the default build, this interns selected string
200202
constants. In the free-threaded build, this also interns non-string
201203
constants. */
@@ -223,19 +225,15 @@ intern_constants(PyObject *tuple, int *modified)
223225
Py_INCREF(interned);
224226
PyTuple_SET_ITEM(tuple, i, interned);
225227
Py_DECREF(v);
226-
if (modified) {
227-
*modified = 1;
228-
}
228+
_constants_tuple_modified(modified);
229229
} else
230230
#endif
231231
if (should_intern_string(v)) {
232232
PyObject *w = v;
233233
_PyUnicode_InternMortal(interp, &v);
234234
if (w != v) {
235235
PyTuple_SET_ITEM(tuple, i, v);
236-
if (modified) {
237-
*modified = 1;
238-
}
236+
_constants_tuple_modified(modified);
239237
}
240238
}
241239
}
@@ -264,9 +262,7 @@ intern_constants(PyObject *tuple, int *modified)
264262

265263
PyTuple_SET_ITEM(tuple, i, v);
266264
Py_DECREF(w);
267-
if (modified) {
268-
*modified = 1;
269-
}
265+
_constants_tuple_modified(modified);
270266
}
271267
Py_DECREF(tmp);
272268
}
@@ -295,9 +291,7 @@ intern_constants(PyObject *tuple, int *modified)
295291
}
296292
PyTuple_SET_ITEM(tuple, i, v);
297293
Py_DECREF(slice);
298-
if (modified) {
299-
*modified = 1;
300-
}
294+
_constants_tuple_modified(modified);
301295
}
302296
Py_DECREF(tmp);
303297
}
@@ -315,9 +309,7 @@ intern_constants(PyObject *tuple, int *modified)
315309
else if (interned != v) {
316310
PyTuple_SET_ITEM(tuple, i, interned);
317311
Py_SETREF(v, interned);
318-
if (modified) {
319-
*modified = 1;
320-
}
312+
_constants_tuple_modified(modified);
321313
}
322314
}
323315
#endif

0 commit comments

Comments
 (0)