Skip to content

Commit 8ed0d76

Browse files
Add a last_index macro.
1 parent 1663bfc commit 8ed0d76

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Objects/moduleobject.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,16 @@ _PyModule_IsExtension(PyObject *obj)
4040
PyObject*
4141
PyModuleDef_Init(PyModuleDef* def)
4242
{
43+
#define last_index _PyRuntime.imports.last_module_index
4344
assert(PyModuleDef_Type.tp_flags & Py_TPFLAGS_READY);
4445
if (def->m_base.m_index == 0) {
45-
_PyRuntime.imports.last_module_index++;
46+
last_index++;
4647
Py_SET_REFCNT(def, 1);
4748
Py_SET_TYPE(def, &PyModuleDef_Type);
48-
def->m_base.m_index = _PyRuntime.imports.last_module_index;
49+
def->m_base.m_index = last_index;
4950
}
5051
return (PyObject*)def;
52+
#undef last_index
5153
}
5254

5355
static int

0 commit comments

Comments
 (0)