Skip to content

Commit 9e77f72

Browse files
committed
shorten capsule name macro; it doesn't need to be so long
1 parent ad643b5 commit 9e77f72

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Python/compile.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ static int compiler_set_qualname(struct compiler *);
206206
static PyCodeObject *assemble(struct compiler *, int addNone);
207207
static PyObject *__doc__;
208208

209-
#define COMPILER_CAPSULE_NAME_COMPILER_UNIT "compile.c compiler unit"
209+
#define CAPSULE_NAME "compile.c compiler unit"
210210

211211
PyObject *
212212
_Py_Mangle(PyObject *privateobj, PyObject *ident)
@@ -608,7 +608,7 @@ compiler_enter_scope(struct compiler *c, identifier name,
608608

609609
/* Push the old compiler_unit on the stack. */
610610
if (c->u) {
611-
PyObject *capsule = PyCapsule_New(c->u, COMPILER_CAPSULE_NAME_COMPILER_UNIT, NULL);
611+
PyObject *capsule = PyCapsule_New(c->u, CAPSULE_NAME, NULL);
612612
if (!capsule || PyList_Append(c->c_stack, capsule) < 0) {
613613
Py_XDECREF(capsule);
614614
compiler_unit_free(u);
@@ -644,7 +644,7 @@ compiler_exit_scope(struct compiler *c)
644644
n = PyList_GET_SIZE(c->c_stack) - 1;
645645
if (n >= 0) {
646646
capsule = PyList_GET_ITEM(c->c_stack, n);
647-
c->u = (struct compiler_unit *)PyCapsule_GetPointer(capsule, COMPILER_CAPSULE_NAME_COMPILER_UNIT);
647+
c->u = (struct compiler_unit *)PyCapsule_GetPointer(capsule, CAPSULE_NAME);
648648
assert(c->u);
649649
/* we are deleting from a list so this really shouldn't fail */
650650
if (PySequence_DelItem(c->c_stack, n) < 0)
@@ -674,7 +674,7 @@ compiler_set_qualname(struct compiler *c)
674674
PyObject *mangled, *capsule;
675675

676676
capsule = PyList_GET_ITEM(c->c_stack, stack_size - 1);
677-
parent = (struct compiler_unit *)PyCapsule_GetPointer(capsule, COMPILER_CAPSULE_NAME_COMPILER_UNIT);
677+
parent = (struct compiler_unit *)PyCapsule_GetPointer(capsule, CAPSULE_NAME);
678678
assert(parent);
679679

680680
if (u->u_scope_type == COMPILER_SCOPE_FUNCTION || u->u_scope_type == COMPILER_SCOPE_CLASS) {

0 commit comments

Comments
 (0)