diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py index daac0966f564a4..e899df93dbde89 100755 --- a/Parser/asdl_c.py +++ b/Parser/asdl_c.py @@ -998,8 +998,8 @@ def visitModule(self, mod): self.emit("if (!init_types()) return NULL;", 1) self.emit('m = PyState_FindModule(&_astmodule);', 1) self.emit("if (!m) return NULL;", 1) - self.emit('Py_INCREF(astmodulestate(m)->AST_type);', 1) self.emit('if (PyModule_AddObject(m, "AST", astmodulestate_global->AST_type) < 0) return NULL;', 1) + self.emit('Py_INCREF(astmodulestate(m)->AST_type);', 1) self.emit('if (PyModule_AddIntMacro(m, PyCF_ALLOW_TOP_LEVEL_AWAIT) < 0)', 1) self.emit("return NULL;", 2) self.emit('if (PyModule_AddIntMacro(m, PyCF_ONLY_AST) < 0)', 1) diff --git a/Python/Python-ast.c b/Python/Python-ast.c index d5465d795cfa4d..048a5440de00cc 100644 --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -9887,9 +9887,9 @@ PyInit__ast(void) if (!init_types()) return NULL; m = PyState_FindModule(&_astmodule); if (!m) return NULL; - Py_INCREF(astmodulestate(m)->AST_type); if (PyModule_AddObject(m, "AST", astmodulestate_global->AST_type) < 0) return NULL; + Py_INCREF(astmodulestate(m)->AST_type); if (PyModule_AddIntMacro(m, PyCF_ALLOW_TOP_LEVEL_AWAIT) < 0) return NULL; if (PyModule_AddIntMacro(m, PyCF_ONLY_AST) < 0)