shorten capsule name macro; it doesn't need to be so long
This commit is contained in:
parent
ad643b59ce
commit
9e77f72fb2
|
@ -206,7 +206,7 @@ static int compiler_set_qualname(struct compiler *);
|
||||||
static PyCodeObject *assemble(struct compiler *, int addNone);
|
static PyCodeObject *assemble(struct compiler *, int addNone);
|
||||||
static PyObject *__doc__;
|
static PyObject *__doc__;
|
||||||
|
|
||||||
#define COMPILER_CAPSULE_NAME_COMPILER_UNIT "compile.c compiler unit"
|
#define CAPSULE_NAME "compile.c compiler unit"
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
_Py_Mangle(PyObject *privateobj, PyObject *ident)
|
_Py_Mangle(PyObject *privateobj, PyObject *ident)
|
||||||
|
@ -608,7 +608,7 @@ compiler_enter_scope(struct compiler *c, identifier name,
|
||||||
|
|
||||||
/* Push the old compiler_unit on the stack. */
|
/* Push the old compiler_unit on the stack. */
|
||||||
if (c->u) {
|
if (c->u) {
|
||||||
PyObject *capsule = PyCapsule_New(c->u, COMPILER_CAPSULE_NAME_COMPILER_UNIT, NULL);
|
PyObject *capsule = PyCapsule_New(c->u, CAPSULE_NAME, NULL);
|
||||||
if (!capsule || PyList_Append(c->c_stack, capsule) < 0) {
|
if (!capsule || PyList_Append(c->c_stack, capsule) < 0) {
|
||||||
Py_XDECREF(capsule);
|
Py_XDECREF(capsule);
|
||||||
compiler_unit_free(u);
|
compiler_unit_free(u);
|
||||||
|
@ -644,7 +644,7 @@ compiler_exit_scope(struct compiler *c)
|
||||||
n = PyList_GET_SIZE(c->c_stack) - 1;
|
n = PyList_GET_SIZE(c->c_stack) - 1;
|
||||||
if (n >= 0) {
|
if (n >= 0) {
|
||||||
capsule = PyList_GET_ITEM(c->c_stack, n);
|
capsule = PyList_GET_ITEM(c->c_stack, n);
|
||||||
c->u = (struct compiler_unit *)PyCapsule_GetPointer(capsule, COMPILER_CAPSULE_NAME_COMPILER_UNIT);
|
c->u = (struct compiler_unit *)PyCapsule_GetPointer(capsule, CAPSULE_NAME);
|
||||||
assert(c->u);
|
assert(c->u);
|
||||||
/* we are deleting from a list so this really shouldn't fail */
|
/* we are deleting from a list so this really shouldn't fail */
|
||||||
if (PySequence_DelItem(c->c_stack, n) < 0)
|
if (PySequence_DelItem(c->c_stack, n) < 0)
|
||||||
|
@ -674,7 +674,7 @@ compiler_set_qualname(struct compiler *c)
|
||||||
PyObject *mangled, *capsule;
|
PyObject *mangled, *capsule;
|
||||||
|
|
||||||
capsule = PyList_GET_ITEM(c->c_stack, stack_size - 1);
|
capsule = PyList_GET_ITEM(c->c_stack, stack_size - 1);
|
||||||
parent = (struct compiler_unit *)PyCapsule_GetPointer(capsule, COMPILER_CAPSULE_NAME_COMPILER_UNIT);
|
parent = (struct compiler_unit *)PyCapsule_GetPointer(capsule, CAPSULE_NAME);
|
||||||
assert(parent);
|
assert(parent);
|
||||||
|
|
||||||
if (u->u_scope_type == COMPILER_SCOPE_FUNCTION || u->u_scope_type == COMPILER_SCOPE_CLASS) {
|
if (u->u_scope_type == COMPILER_SCOPE_FUNCTION || u->u_scope_type == COMPILER_SCOPE_CLASS) {
|
||||||
|
|
Loading…
Reference in New Issue