Python-checkins
Threads by month
- ----- 2026 -----
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
July 2020
- 1 participants
- 218 discussions
https://github.com/python/cpython/commit/74419f0c64959bb8392fcf365905841042…
commit: 74419f0c64959bb8392fcf3659058410423038e1
branch: master
author: Victor Stinner <vstinner(a)python.org>
committer: GitHub <noreply(a)github.com>
date: 2020-07-03T11:35:37+02:00
summary:
bpo-41194: Pass module state in Python-ast.c (GH-21284)
Rework asdl_c.py to pass the module state to functions in
Python-ast.c, instead of using astmodulestate_global.
Handle also PyState_AddModule() failure in init_types().
files:
M Parser/asdl_c.py
M Python/Python-ast.c
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index ce9724aee3ed8..39e216b8192b1 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -387,7 +387,7 @@ def visitField(self, sum):
class Obj2ModPrototypeVisitor(PickleVisitor):
def visitProduct(self, prod, name):
- code = "static int obj2ast_%s(PyObject* obj, %s* out, PyArena* arena);"
+ code = "static int obj2ast_%s(astmodulestate *state, PyObject* obj, %s* out, PyArena* arena);"
self.emit(code % (name, get_c_type(name)), 0)
visitSum = visitProduct
@@ -397,7 +397,7 @@ class Obj2ModVisitor(PickleVisitor):
def funcHeader(self, name):
ctype = get_c_type(name)
self.emit("int", 0)
- self.emit("obj2ast_%s(PyObject* obj, %s* out, PyArena* arena)" % (name, ctype), 0)
+ self.emit("obj2ast_%s(astmodulestate *state, PyObject* obj, %s* out, PyArena* arena)" % (name, ctype), 0)
self.emit("{", 0)
self.emit("int isinstance;", 1)
self.emit("", 0)
@@ -419,7 +419,7 @@ def simpleSum(self, sum, name):
self.funcHeader(name)
for t in sum.types:
line = ("isinstance = PyObject_IsInstance(obj, "
- "astmodulestate_global->%s_type);")
+ "state->%s_type);")
self.emit(line % (t.name,), 1)
self.emit("if (isinstance == -1) {", 1)
self.emit("return 1;", 2)
@@ -448,7 +448,7 @@ def complexSum(self, sum, name):
for a in sum.attributes:
self.visitField(a, name, sum=sum, depth=1)
for t in sum.types:
- self.emit("tp = astmodulestate_global->%s_type;" % (t.name,), 1)
+ self.emit("tp = state->%s_type;" % (t.name,), 1)
self.emit("isinstance = PyObject_IsInstance(obj, tp);", 1)
self.emit("if (isinstance == -1) {", 1)
self.emit("return 1;", 2)
@@ -479,7 +479,7 @@ def visitSum(self, sum, name):
def visitProduct(self, prod, name):
ctype = get_c_type(name)
self.emit("int", 0)
- self.emit("obj2ast_%s(PyObject* obj, %s* out, PyArena* arena)" % (name, ctype), 0)
+ self.emit("obj2ast_%s(astmodulestate *state, PyObject* obj, %s* out, PyArena* arena)" % (name, ctype), 0)
self.emit("{", 0)
self.emit("PyObject* tmp = NULL;", 1)
for f in prod.fields:
@@ -525,7 +525,7 @@ def isSimpleType(self, field):
def visitField(self, field, name, sum=None, prod=None, depth=0):
ctype = get_c_type(field.type)
- line = "if (_PyObject_LookupAttr(obj, astmodulestate_global->%s, &tmp) < 0) {"
+ line = "if (_PyObject_LookupAttr(obj, state->%s, &tmp) < 0) {"
self.emit(line % field.name, depth)
self.emit("return 1;", depth+1)
self.emit("}", depth)
@@ -568,7 +568,7 @@ def visitField(self, field, name, sum=None, prod=None, depth=0):
self.emit("%s val;" % ctype, depth+2)
self.emit("PyObject *tmp2 = PyList_GET_ITEM(tmp, i);", depth+2)
self.emit("Py_INCREF(tmp2);", depth+2)
- self.emit("res = obj2ast_%s(tmp2, &val, arena);" %
+ self.emit("res = obj2ast_%s(state, tmp2, &val, arena);" %
field.type, depth+2, reflow=False)
self.emit("Py_DECREF(tmp2);", depth+2)
self.emit("if (res != 0) goto failed;", depth+2)
@@ -582,7 +582,7 @@ def visitField(self, field, name, sum=None, prod=None, depth=0):
self.emit("asdl_seq_SET(%s, i, val);" % field.name, depth+2)
self.emit("}", depth+1)
else:
- self.emit("res = obj2ast_%s(tmp, &%s, arena);" %
+ self.emit("res = obj2ast_%s(state, tmp, &%s, arena);" %
(field.type, field.name), depth+1)
self.emit("if (res != 0) goto failed;", depth+1)
@@ -604,7 +604,7 @@ class PyTypesDeclareVisitor(PickleVisitor):
def visitProduct(self, prod, name):
self.emit_type("%s_type" % name)
- self.emit("static PyObject* ast2obj_%s(void*);" % name, 0)
+ self.emit("static PyObject* ast2obj_%s(astmodulestate *state, void*);" % name, 0)
if prod.attributes:
for a in prod.attributes:
self.emit_identifier(a.name)
@@ -634,7 +634,7 @@ def visitSum(self, sum, name):
ptype = get_c_type(name)
for t in sum.types:
self.emit_singleton("%s_singleton" % t.name)
- self.emit("static PyObject* ast2obj_%s(%s);" % (name, ptype), 0)
+ self.emit("static PyObject* ast2obj_%s(astmodulestate *state, %s);" % (name, ptype), 0)
for t in sum.types:
self.visitConstructor(t, name)
@@ -691,7 +691,8 @@ def visitModule(self, mod):
Py_ssize_t i, numfields = 0;
int res = -1;
PyObject *key, *value, *fields;
- if (_PyObject_LookupAttr((PyObject*)Py_TYPE(self), astmodulestate_global->_fields, &fields) < 0) {
+ astmodulestate *state = astmodulestate_global;
+ if (_PyObject_LookupAttr((PyObject*)Py_TYPE(self), state->_fields, &fields) < 0) {
goto cleanup;
}
if (fields) {
@@ -759,8 +760,9 @@ def visitModule(self, mod):
static PyObject *
ast_type_reduce(PyObject *self, PyObject *unused)
{
+ astmodulestate *state = astmodulestate_global;
PyObject *dict;
- if (_PyObject_LookupAttr(self, astmodulestate_global->__dict__, &dict) < 0) {
+ if (_PyObject_LookupAttr(self, state->__dict__, &dict) < 0) {
return NULL;
}
if (dict) {
@@ -809,7 +811,8 @@ def visitModule(self, mod):
};
static PyObject *
-make_type(const char *type, PyObject* base, const char* const* fields, int num_fields, const char *doc)
+make_type(astmodulestate *state, const char *type, PyObject* base,
+ const char* const* fields, int num_fields, const char *doc)
{
PyObject *fnames, *result;
int i;
@@ -825,16 +828,16 @@ def visitModule(self, mod):
}
result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){OOOOOs}",
type, base,
- astmodulestate_global->_fields, fnames,
- astmodulestate_global->__module__,
- astmodulestate_global->ast,
- astmodulestate_global->__doc__, doc);
+ state->_fields, fnames,
+ state->__module__,
+ state->ast,
+ state->__doc__, doc);
Py_DECREF(fnames);
return result;
}
static int
-add_attributes(PyObject *type, const char * const *attrs, int num_fields)
+add_attributes(astmodulestate *state, PyObject *type, const char * const *attrs, int num_fields)
{
int i, result;
PyObject *s, *l = PyTuple_New(num_fields);
@@ -848,14 +851,14 @@ def visitModule(self, mod):
}
PyTuple_SET_ITEM(l, i, s);
}
- result = PyObject_SetAttr(type, astmodulestate_global->_attributes, l) >= 0;
+ result = PyObject_SetAttr(type, state->_attributes, l) >= 0;
Py_DECREF(l);
return result;
}
/* Conversion AST -> Python */
-static PyObject* ast2obj_list(asdl_seq *seq, PyObject* (*func)(void*))
+static PyObject* ast2obj_list(astmodulestate *state, asdl_seq *seq, PyObject* (*func)(astmodulestate *state, void*))
{
Py_ssize_t i, n = asdl_seq_LEN(seq);
PyObject *result = PyList_New(n);
@@ -863,7 +866,7 @@ def visitModule(self, mod):
if (!result)
return NULL;
for (i = 0; i < n; i++) {
- value = func(asdl_seq_GET(seq, i));
+ value = func(state, asdl_seq_GET(seq, i));
if (!value) {
Py_DECREF(result);
return NULL;
@@ -873,7 +876,7 @@ def visitModule(self, mod):
return result;
}
-static PyObject* ast2obj_object(void *o)
+static PyObject* ast2obj_object(astmodulestate *Py_UNUSED(state), void *o)
{
if (!o)
o = Py_None;
@@ -884,14 +887,14 @@ def visitModule(self, mod):
#define ast2obj_identifier ast2obj_object
#define ast2obj_string ast2obj_object
-static PyObject* ast2obj_int(long b)
+static PyObject* ast2obj_int(astmodulestate *Py_UNUSED(state), long b)
{
return PyLong_FromLong(b);
}
/* Conversion Python -> AST */
-static int obj2ast_object(PyObject* obj, PyObject** out, PyArena* arena)
+static int obj2ast_object(astmodulestate *Py_UNUSED(state), PyObject* obj, PyObject** out, PyArena* arena)
{
if (obj == Py_None)
obj = NULL;
@@ -906,7 +909,7 @@ def visitModule(self, mod):
return 0;
}
-static int obj2ast_constant(PyObject* obj, PyObject** out, PyArena* arena)
+static int obj2ast_constant(astmodulestate *Py_UNUSED(state), PyObject* obj, PyObject** out, PyArena* arena)
{
if (PyArena_AddPyObject(arena, obj) < 0) {
*out = NULL;
@@ -917,25 +920,25 @@ def visitModule(self, mod):
return 0;
}
-static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena)
+static int obj2ast_identifier(astmodulestate *state, PyObject* obj, PyObject** out, PyArena* arena)
{
if (!PyUnicode_CheckExact(obj) && obj != Py_None) {
PyErr_SetString(PyExc_TypeError, "AST identifier must be of type str");
return 1;
}
- return obj2ast_object(obj, out, arena);
+ return obj2ast_object(state, obj, out, arena);
}
-static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena)
+static int obj2ast_string(astmodulestate *state, PyObject* obj, PyObject** out, PyArena* arena)
{
if (!PyUnicode_CheckExact(obj) && !PyBytes_CheckExact(obj)) {
PyErr_SetString(PyExc_TypeError, "AST string must be of type str");
return 1;
}
- return obj2ast_object(obj, out, arena);
+ return obj2ast_object(state, obj, out, arena);
}
-static int obj2ast_int(PyObject* obj, int* out, PyArena* arena)
+static int obj2ast_int(astmodulestate* Py_UNUSED(state), PyObject* obj, int* out, PyArena* arena)
{
int i;
if (!PyLong_Check(obj)) {
@@ -950,13 +953,13 @@ def visitModule(self, mod):
return 0;
}
-static int add_ast_fields(void)
+static int add_ast_fields(astmodulestate *state)
{
PyObject *empty_tuple;
empty_tuple = PyTuple_New(0);
if (!empty_tuple ||
- PyObject_SetAttrString(astmodulestate_global->AST_type, "_fields", empty_tuple) < 0 ||
- PyObject_SetAttrString(astmodulestate_global->AST_type, "_attributes", empty_tuple) < 0) {
+ PyObject_SetAttrString(state->AST_type, "_fields", empty_tuple) < 0 ||
+ PyObject_SetAttrString(state->AST_type, "_attributes", empty_tuple) < 0) {
Py_XDECREF(empty_tuple);
return -1;
}
@@ -968,18 +971,24 @@ def visitModule(self, mod):
self.emit("static int init_types(void)",0)
self.emit("{", 0)
- self.emit("PyObject *m;", 1)
- self.emit("if (PyState_FindModule(&_astmodule) == NULL) {", 1)
- self.emit("m = PyModule_Create(&_astmodule);", 2)
- self.emit("if (!m) return 0;", 2)
- self.emit("PyState_AddModule(m, &_astmodule);", 2)
+ self.emit("PyObject *module = PyState_FindModule(&_astmodule);", 1)
+ self.emit("if (module == NULL) {", 1)
+ self.emit("module = PyModule_Create(&_astmodule);", 2)
+ self.emit("if (!module) {", 2)
+ self.emit("return 0;", 3)
+ self.emit("}", 2)
+ self.emit("if (PyState_AddModule(module, &_astmodule) < 0) {", 2)
+ self.emit("return 0;", 3)
+ self.emit("}", 2)
self.emit("}", 1)
- self.emit("astmodulestate *state = astmodulestate_global;", 1)
+ self.emit("", 0)
+
+ self.emit("astmodulestate *state = get_ast_state(module);", 1)
self.emit("if (state->initialized) return 1;", 1)
- self.emit("if (init_identifiers() < 0) return 0;", 1)
+ self.emit("if (init_identifiers(state) < 0) return 0;", 1)
self.emit("state->AST_type = PyType_FromSpec(&AST_type_spec);", 1)
self.emit("if (!state->AST_type) return 0;", 1)
- self.emit("if (add_ast_fields() < 0) return 0;", 1)
+ self.emit("if (add_ast_fields(state) < 0) return 0;", 1)
for dfn in mod.dfns:
self.visit(dfn)
self.emit("state->initialized = 1;", 1)
@@ -991,31 +1000,31 @@ def visitProduct(self, prod, name):
fields = name+"_fields"
else:
fields = "NULL"
- self.emit('state->%s_type = make_type("%s", state->AST_type, %s, %d,' %
+ self.emit('state->%s_type = make_type(state, "%s", state->AST_type, %s, %d,' %
(name, name, fields, len(prod.fields)), 1)
self.emit('%s);' % reflow_c_string(asdl_of(name, prod), 2), 2, reflow=False)
self.emit("if (!state->%s_type) return 0;" % name, 1)
self.emit_type("AST_type")
self.emit_type("%s_type" % name)
if prod.attributes:
- self.emit("if (!add_attributes(state->%s_type, %s_attributes, %d)) return 0;" %
+ self.emit("if (!add_attributes(state, state->%s_type, %s_attributes, %d)) return 0;" %
(name, name, len(prod.attributes)), 1)
else:
- self.emit("if (!add_attributes(state->%s_type, NULL, 0)) return 0;" % name, 1)
+ self.emit("if (!add_attributes(state, state->%s_type, NULL, 0)) return 0;" % name, 1)
self.emit_defaults(name, prod.fields, 1)
self.emit_defaults(name, prod.attributes, 1)
def visitSum(self, sum, name):
- self.emit('state->%s_type = make_type("%s", state->AST_type, NULL, 0,' %
+ self.emit('state->%s_type = make_type(state, "%s", state->AST_type, NULL, 0,' %
(name, name), 1)
self.emit('%s);' % reflow_c_string(asdl_of(name, sum), 2), 2, reflow=False)
self.emit_type("%s_type" % name)
self.emit("if (!state->%s_type) return 0;" % name, 1)
if sum.attributes:
- self.emit("if (!add_attributes(state->%s_type, %s_attributes, %d)) return 0;" %
+ self.emit("if (!add_attributes(state, state->%s_type, %s_attributes, %d)) return 0;" %
(name, name, len(sum.attributes)), 1)
else:
- self.emit("if (!add_attributes(state->%s_type, NULL, 0)) return 0;" % name, 1)
+ self.emit("if (!add_attributes(state, state->%s_type, NULL, 0)) return 0;" % name, 1)
self.emit_defaults(name, sum.attributes, 1)
simple = is_simple(sum)
for t in sum.types:
@@ -1026,7 +1035,7 @@ def visitConstructor(self, cons, name, simple):
fields = cons.name+"_fields"
else:
fields = "NULL"
- self.emit('state->%s_type = make_type("%s", state->%s_type, %s, %d,' %
+ self.emit('state->%s_type = make_type(state, "%s", state->%s_type, %s, %d,' %
(cons.name, cons.name, name, fields, len(cons.fields)), 1)
self.emit('%s);' % reflow_c_string(asdl_of(cons.name, cons), 2), 2, reflow=False)
self.emit("if (!state->%s_type) return 0;" % cons.name, 1)
@@ -1056,10 +1065,13 @@ 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('if (PyModule_AddObject(m, "AST", astmodulestate_global->AST_type) < 0) {', 1)
+ self.emit('astmodulestate *state = get_ast_state(m);', 1)
+ self.emit('', 1)
+
+ self.emit('if (PyModule_AddObject(m, "AST", state->AST_type) < 0) {', 1)
self.emit('goto error;', 2)
self.emit('}', 1)
- self.emit('Py_INCREF(astmodulestate(m)->AST_type);', 1)
+ self.emit('Py_INCREF(state->AST_type);', 1)
self.emit('if (PyModule_AddIntMacro(m, PyCF_ALLOW_TOP_LEVEL_AWAIT) < 0) {', 1)
self.emit("goto error;", 2)
self.emit('}', 1)
@@ -1090,10 +1102,10 @@ def visitConstructor(self, cons, name):
def addObj(self, name):
self.emit("if (PyModule_AddObject(m, \"%s\", "
- "astmodulestate_global->%s_type) < 0) {" % (name, name), 1)
+ "state->%s_type) < 0) {" % (name, name), 1)
self.emit("goto error;", 2)
self.emit('}', 1)
- self.emit("Py_INCREF(astmodulestate(m)->%s_type);" % name, 1)
+ self.emit("Py_INCREF(state->%s_type);" % name, 1)
_SPECIALIZED_SEQUENCES = ('stmt', 'expr')
@@ -1127,7 +1139,7 @@ class ObjVisitor(PickleVisitor):
def func_begin(self, name):
ctype = get_c_type(name)
self.emit("PyObject*", 0)
- self.emit("ast2obj_%s(void* _o)" % (name), 0)
+ self.emit("ast2obj_%s(astmodulestate *state, void* _o)" % (name), 0)
self.emit("{", 0)
self.emit("%s o = (%s)_o;" % (ctype, ctype), 1)
self.emit("PyObject *result = NULL, *value = NULL;", 1)
@@ -1135,7 +1147,6 @@ def func_begin(self, name):
self.emit('if (!o) {', 1)
self.emit("Py_RETURN_NONE;", 2)
self.emit("}", 1)
- self.emit('', 0)
def func_end(self):
self.emit("return result;", 1)
@@ -1157,43 +1168,43 @@ def visitSum(self, sum, name):
self.visitConstructor(t, i + 1, name)
self.emit("}", 1)
for a in sum.attributes:
- self.emit("value = ast2obj_%s(o->%s);" % (a.type, a.name), 1)
+ self.emit("value = ast2obj_%s(state, o->%s);" % (a.type, a.name), 1)
self.emit("if (!value) goto failed;", 1)
- self.emit('if (PyObject_SetAttr(result, astmodulestate_global->%s, value) < 0)' % a.name, 1)
+ self.emit('if (PyObject_SetAttr(result, state->%s, value) < 0)' % a.name, 1)
self.emit('goto failed;', 2)
self.emit('Py_DECREF(value);', 1)
self.func_end()
def simpleSum(self, sum, name):
- self.emit("PyObject* ast2obj_%s(%s_ty o)" % (name, name), 0)
+ self.emit("PyObject* ast2obj_%s(astmodulestate *state, %s_ty o)" % (name, name), 0)
self.emit("{", 0)
self.emit("switch(o) {", 1)
for t in sum.types:
self.emit("case %s:" % t.name, 2)
- self.emit("Py_INCREF(astmodulestate_global->%s_singleton);" % t.name, 3)
- self.emit("return astmodulestate_global->%s_singleton;" % t.name, 3)
+ self.emit("Py_INCREF(state->%s_singleton);" % t.name, 3)
+ self.emit("return state->%s_singleton;" % t.name, 3)
self.emit("}", 1)
self.emit("Py_UNREACHABLE();", 1);
self.emit("}", 0)
def visitProduct(self, prod, name):
self.func_begin(name)
- self.emit("tp = (PyTypeObject *)astmodulestate_global->%s_type;" % name, 1)
+ self.emit("tp = (PyTypeObject *)state->%s_type;" % name, 1)
self.emit("result = PyType_GenericNew(tp, NULL, NULL);", 1);
self.emit("if (!result) return NULL;", 1)
for field in prod.fields:
self.visitField(field, name, 1, True)
for a in prod.attributes:
- self.emit("value = ast2obj_%s(o->%s);" % (a.type, a.name), 1)
+ self.emit("value = ast2obj_%s(state, o->%s);" % (a.type, a.name), 1)
self.emit("if (!value) goto failed;", 1)
- self.emit("if (PyObject_SetAttr(result, astmodulestate_global->%s, value) < 0)" % a.name, 1)
+ self.emit("if (PyObject_SetAttr(result, state->%s, value) < 0)" % a.name, 1)
self.emit('goto failed;', 2)
self.emit('Py_DECREF(value);', 1)
self.func_end()
def visitConstructor(self, cons, enum, name):
self.emit("case %s_kind:" % cons.name, 1)
- self.emit("tp = (PyTypeObject *)astmodulestate_global->%s_type;" % cons.name, 2)
+ self.emit("tp = (PyTypeObject *)state->%s_type;" % cons.name, 2)
self.emit("result = PyType_GenericNew(tp, NULL, NULL);", 2);
self.emit("if (!result) goto failed;", 2)
for f in cons.fields:
@@ -1209,7 +1220,7 @@ def emit(s, d):
value = "o->v.%s.%s" % (name, field.name)
self.set(field, value, depth)
emit("if (!value) goto failed;", 0)
- emit("if (PyObject_SetAttr(result, astmodulestate_global->%s, value) == -1)" % field.name, 0)
+ emit("if (PyObject_SetAttr(result, state->%s, value) == -1)" % field.name, 0)
emit("goto failed;", 1)
emit("Py_DECREF(value);", 0)
@@ -1237,14 +1248,14 @@ def set(self, field, value, depth):
self.emit("if (!value) goto failed;", depth+1)
self.emit("for(i = 0; i < n; i++)", depth+1)
# This cannot fail, so no need for error handling
- self.emit("PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)asdl_seq_GET(%s, i)));" % value,
+ self.emit("PyList_SET_ITEM(value, i, ast2obj_cmpop(state, (cmpop_ty)asdl_seq_GET(%s, i)));" % value,
depth+2, reflow=False)
self.emit("}", depth)
else:
- self.emit("value = ast2obj_list(%s, ast2obj_%s);" % (value, field.type), depth)
+ self.emit("value = ast2obj_list(state, %s, ast2obj_%s);" % (value, field.type), depth)
else:
ctype = get_c_type(field.type)
- self.emit("value = ast2obj_%s(%s);" % (field.type, value), depth, reflow=False)
+ self.emit("value = ast2obj_%s(state, %s);" % (field.type, value), depth, reflow=False)
class PartingShots(StaticVisitor):
@@ -1254,13 +1265,13 @@ class PartingShots(StaticVisitor):
{
if (!init_types())
return NULL;
- return ast2obj_mod(t);
+ astmodulestate *state = astmodulestate_global;
+ return ast2obj_mod(state, t);
}
/* mode is 0 for "exec", 1 for "eval" and 2 for "single" input */
mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
{
- PyObject *req_type[3];
const char * const req_name[] = {"Module", "Expression", "Interactive"};
int isinstance;
@@ -1268,9 +1279,11 @@ class PartingShots(StaticVisitor):
return NULL;
}
- req_type[0] = astmodulestate_global->Module_type;
- req_type[1] = astmodulestate_global->Expression_type;
- req_type[2] = astmodulestate_global->Interactive_type;
+ astmodulestate *state = astmodulestate_global;
+ PyObject *req_type[3];
+ req_type[0] = state->Module_type;
+ req_type[1] = state->Expression_type;
+ req_type[2] = state->Interactive_type;
assert(0 <= mode && mode <= 2);
@@ -1287,7 +1300,7 @@ class PartingShots(StaticVisitor):
}
mod_ty res = NULL;
- if (obj2ast_mod(ast, &res, arena) != 0)
+ if (obj2ast_mod(state, ast, &res, arena) != 0)
return NULL;
else
return res;
@@ -1297,7 +1310,8 @@ class PartingShots(StaticVisitor):
{
if (!init_types())
return -1;
- return PyObject_IsInstance(obj, astmodulestate_global->AST_type);
+ astmodulestate *state = astmodulestate_global;
+ return PyObject_IsInstance(obj, state->AST_type);
}
"""
@@ -1347,22 +1361,31 @@ def generate_module_def(f, mod):
f.write(' PyObject *' + s + ';\n')
f.write('} astmodulestate;\n\n')
f.write("""
-#define astmodulestate(o) ((astmodulestate *)PyModule_GetState(o))
+static astmodulestate *
+get_ast_state(PyObject *module)
+{
+ assert(module != NULL);
+ void *state = PyModule_GetState(module);
+ assert(state != NULL);
+ return (astmodulestate *)state;
+}
static int astmodule_clear(PyObject *module)
{
+ astmodulestate *state = get_ast_state(module);
""")
for s in module_state:
- f.write(" Py_CLEAR(astmodulestate(module)->" + s + ');\n')
+ f.write(" Py_CLEAR(state->" + s + ');\n')
f.write("""
return 0;
}
static int astmodule_traverse(PyObject *module, visitproc visit, void* arg)
{
+ astmodulestate *state = get_ast_state(module);
""")
for s in module_state:
- f.write(" Py_VISIT(astmodulestate(module)->" + s + ');\n')
+ f.write(" Py_VISIT(state->" + s + ');\n')
f.write("""
return 0;
}
@@ -1383,12 +1406,11 @@ def generate_module_def(f, mod):
astmodule_free,
};
-#define astmodulestate_global ((astmodulestate *)PyModule_GetState(PyState_FindModule(&_astmodule)))
+#define astmodulestate_global get_ast_state(PyState_FindModule(&_astmodule))
""")
- f.write('static int init_identifiers(void)\n')
+ f.write('static int init_identifiers(astmodulestate *state)\n')
f.write('{\n')
- f.write(' astmodulestate *state = astmodulestate_global;\n')
for identifier in state_strings:
f.write(' if ((state->' + identifier)
f.write(' = PyUnicode_InternFromString("')
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index 694987dd07788..3296b067584d0 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -224,442 +224,451 @@ typedef struct {
} astmodulestate;
-#define astmodulestate(o) ((astmodulestate *)PyModule_GetState(o))
+static astmodulestate *
+get_ast_state(PyObject *module)
+{
+ assert(module != NULL);
+ void *state = PyModule_GetState(module);
+ assert(state != NULL);
+ return (astmodulestate *)state;
+}
static int astmodule_clear(PyObject *module)
{
- Py_CLEAR(astmodulestate(module)->AST_type);
- Py_CLEAR(astmodulestate(module)->Add_singleton);
- Py_CLEAR(astmodulestate(module)->Add_type);
- Py_CLEAR(astmodulestate(module)->And_singleton);
- Py_CLEAR(astmodulestate(module)->And_type);
- Py_CLEAR(astmodulestate(module)->AnnAssign_type);
- Py_CLEAR(astmodulestate(module)->Assert_type);
- Py_CLEAR(astmodulestate(module)->Assign_type);
- Py_CLEAR(astmodulestate(module)->AsyncFor_type);
- Py_CLEAR(astmodulestate(module)->AsyncFunctionDef_type);
- Py_CLEAR(astmodulestate(module)->AsyncWith_type);
- Py_CLEAR(astmodulestate(module)->Attribute_type);
- Py_CLEAR(astmodulestate(module)->AugAssign_type);
- Py_CLEAR(astmodulestate(module)->Await_type);
- Py_CLEAR(astmodulestate(module)->BinOp_type);
- Py_CLEAR(astmodulestate(module)->BitAnd_singleton);
- Py_CLEAR(astmodulestate(module)->BitAnd_type);
- Py_CLEAR(astmodulestate(module)->BitOr_singleton);
- Py_CLEAR(astmodulestate(module)->BitOr_type);
- Py_CLEAR(astmodulestate(module)->BitXor_singleton);
- Py_CLEAR(astmodulestate(module)->BitXor_type);
- Py_CLEAR(astmodulestate(module)->BoolOp_type);
- Py_CLEAR(astmodulestate(module)->Break_type);
- Py_CLEAR(astmodulestate(module)->Call_type);
- Py_CLEAR(astmodulestate(module)->ClassDef_type);
- Py_CLEAR(astmodulestate(module)->Compare_type);
- Py_CLEAR(astmodulestate(module)->Constant_type);
- Py_CLEAR(astmodulestate(module)->Continue_type);
- Py_CLEAR(astmodulestate(module)->Del_singleton);
- Py_CLEAR(astmodulestate(module)->Del_type);
- Py_CLEAR(astmodulestate(module)->Delete_type);
- Py_CLEAR(astmodulestate(module)->DictComp_type);
- Py_CLEAR(astmodulestate(module)->Dict_type);
- Py_CLEAR(astmodulestate(module)->Div_singleton);
- Py_CLEAR(astmodulestate(module)->Div_type);
- Py_CLEAR(astmodulestate(module)->Eq_singleton);
- Py_CLEAR(astmodulestate(module)->Eq_type);
- Py_CLEAR(astmodulestate(module)->ExceptHandler_type);
- Py_CLEAR(astmodulestate(module)->Expr_type);
- Py_CLEAR(astmodulestate(module)->Expression_type);
- Py_CLEAR(astmodulestate(module)->FloorDiv_singleton);
- Py_CLEAR(astmodulestate(module)->FloorDiv_type);
- Py_CLEAR(astmodulestate(module)->For_type);
- Py_CLEAR(astmodulestate(module)->FormattedValue_type);
- Py_CLEAR(astmodulestate(module)->FunctionDef_type);
- Py_CLEAR(astmodulestate(module)->FunctionType_type);
- Py_CLEAR(astmodulestate(module)->GeneratorExp_type);
- Py_CLEAR(astmodulestate(module)->Global_type);
- Py_CLEAR(astmodulestate(module)->GtE_singleton);
- Py_CLEAR(astmodulestate(module)->GtE_type);
- Py_CLEAR(astmodulestate(module)->Gt_singleton);
- Py_CLEAR(astmodulestate(module)->Gt_type);
- Py_CLEAR(astmodulestate(module)->IfExp_type);
- Py_CLEAR(astmodulestate(module)->If_type);
- Py_CLEAR(astmodulestate(module)->ImportFrom_type);
- Py_CLEAR(astmodulestate(module)->Import_type);
- Py_CLEAR(astmodulestate(module)->In_singleton);
- Py_CLEAR(astmodulestate(module)->In_type);
- Py_CLEAR(astmodulestate(module)->Interactive_type);
- Py_CLEAR(astmodulestate(module)->Invert_singleton);
- Py_CLEAR(astmodulestate(module)->Invert_type);
- Py_CLEAR(astmodulestate(module)->IsNot_singleton);
- Py_CLEAR(astmodulestate(module)->IsNot_type);
- Py_CLEAR(astmodulestate(module)->Is_singleton);
- Py_CLEAR(astmodulestate(module)->Is_type);
- Py_CLEAR(astmodulestate(module)->JoinedStr_type);
- Py_CLEAR(astmodulestate(module)->LShift_singleton);
- Py_CLEAR(astmodulestate(module)->LShift_type);
- Py_CLEAR(astmodulestate(module)->Lambda_type);
- Py_CLEAR(astmodulestate(module)->ListComp_type);
- Py_CLEAR(astmodulestate(module)->List_type);
- Py_CLEAR(astmodulestate(module)->Load_singleton);
- Py_CLEAR(astmodulestate(module)->Load_type);
- Py_CLEAR(astmodulestate(module)->LtE_singleton);
- Py_CLEAR(astmodulestate(module)->LtE_type);
- Py_CLEAR(astmodulestate(module)->Lt_singleton);
- Py_CLEAR(astmodulestate(module)->Lt_type);
- Py_CLEAR(astmodulestate(module)->MatMult_singleton);
- Py_CLEAR(astmodulestate(module)->MatMult_type);
- Py_CLEAR(astmodulestate(module)->Mod_singleton);
- Py_CLEAR(astmodulestate(module)->Mod_type);
- Py_CLEAR(astmodulestate(module)->Module_type);
- Py_CLEAR(astmodulestate(module)->Mult_singleton);
- Py_CLEAR(astmodulestate(module)->Mult_type);
- Py_CLEAR(astmodulestate(module)->Name_type);
- Py_CLEAR(astmodulestate(module)->NamedExpr_type);
- Py_CLEAR(astmodulestate(module)->Nonlocal_type);
- Py_CLEAR(astmodulestate(module)->NotEq_singleton);
- Py_CLEAR(astmodulestate(module)->NotEq_type);
- Py_CLEAR(astmodulestate(module)->NotIn_singleton);
- Py_CLEAR(astmodulestate(module)->NotIn_type);
- Py_CLEAR(astmodulestate(module)->Not_singleton);
- Py_CLEAR(astmodulestate(module)->Not_type);
- Py_CLEAR(astmodulestate(module)->Or_singleton);
- Py_CLEAR(astmodulestate(module)->Or_type);
- Py_CLEAR(astmodulestate(module)->Pass_type);
- Py_CLEAR(astmodulestate(module)->Pow_singleton);
- Py_CLEAR(astmodulestate(module)->Pow_type);
- Py_CLEAR(astmodulestate(module)->RShift_singleton);
- Py_CLEAR(astmodulestate(module)->RShift_type);
- Py_CLEAR(astmodulestate(module)->Raise_type);
- Py_CLEAR(astmodulestate(module)->Return_type);
- Py_CLEAR(astmodulestate(module)->SetComp_type);
- Py_CLEAR(astmodulestate(module)->Set_type);
- Py_CLEAR(astmodulestate(module)->Slice_type);
- Py_CLEAR(astmodulestate(module)->Starred_type);
- Py_CLEAR(astmodulestate(module)->Store_singleton);
- Py_CLEAR(astmodulestate(module)->Store_type);
- Py_CLEAR(astmodulestate(module)->Sub_singleton);
- Py_CLEAR(astmodulestate(module)->Sub_type);
- Py_CLEAR(astmodulestate(module)->Subscript_type);
- Py_CLEAR(astmodulestate(module)->Try_type);
- Py_CLEAR(astmodulestate(module)->Tuple_type);
- Py_CLEAR(astmodulestate(module)->TypeIgnore_type);
- Py_CLEAR(astmodulestate(module)->UAdd_singleton);
- Py_CLEAR(astmodulestate(module)->UAdd_type);
- Py_CLEAR(astmodulestate(module)->USub_singleton);
- Py_CLEAR(astmodulestate(module)->USub_type);
- Py_CLEAR(astmodulestate(module)->UnaryOp_type);
- Py_CLEAR(astmodulestate(module)->While_type);
- Py_CLEAR(astmodulestate(module)->With_type);
- Py_CLEAR(astmodulestate(module)->YieldFrom_type);
- Py_CLEAR(astmodulestate(module)->Yield_type);
- Py_CLEAR(astmodulestate(module)->__dict__);
- Py_CLEAR(astmodulestate(module)->__doc__);
- Py_CLEAR(astmodulestate(module)->__module__);
- Py_CLEAR(astmodulestate(module)->_attributes);
- Py_CLEAR(astmodulestate(module)->_fields);
- Py_CLEAR(astmodulestate(module)->alias_type);
- Py_CLEAR(astmodulestate(module)->annotation);
- Py_CLEAR(astmodulestate(module)->arg);
- Py_CLEAR(astmodulestate(module)->arg_type);
- Py_CLEAR(astmodulestate(module)->args);
- Py_CLEAR(astmodulestate(module)->argtypes);
- Py_CLEAR(astmodulestate(module)->arguments_type);
- Py_CLEAR(astmodulestate(module)->asname);
- Py_CLEAR(astmodulestate(module)->ast);
- Py_CLEAR(astmodulestate(module)->attr);
- Py_CLEAR(astmodulestate(module)->bases);
- Py_CLEAR(astmodulestate(module)->body);
- Py_CLEAR(astmodulestate(module)->boolop_type);
- Py_CLEAR(astmodulestate(module)->cause);
- Py_CLEAR(astmodulestate(module)->cmpop_type);
- Py_CLEAR(astmodulestate(module)->col_offset);
- Py_CLEAR(astmodulestate(module)->comparators);
- Py_CLEAR(astmodulestate(module)->comprehension_type);
- Py_CLEAR(astmodulestate(module)->context_expr);
- Py_CLEAR(astmodulestate(module)->conversion);
- Py_CLEAR(astmodulestate(module)->ctx);
- Py_CLEAR(astmodulestate(module)->decorator_list);
- Py_CLEAR(astmodulestate(module)->defaults);
- Py_CLEAR(astmodulestate(module)->elt);
- Py_CLEAR(astmodulestate(module)->elts);
- Py_CLEAR(astmodulestate(module)->end_col_offset);
- Py_CLEAR(astmodulestate(module)->end_lineno);
- Py_CLEAR(astmodulestate(module)->exc);
- Py_CLEAR(astmodulestate(module)->excepthandler_type);
- Py_CLEAR(astmodulestate(module)->expr_context_type);
- Py_CLEAR(astmodulestate(module)->expr_type);
- Py_CLEAR(astmodulestate(module)->finalbody);
- Py_CLEAR(astmodulestate(module)->format_spec);
- Py_CLEAR(astmodulestate(module)->func);
- Py_CLEAR(astmodulestate(module)->generators);
- Py_CLEAR(astmodulestate(module)->handlers);
- Py_CLEAR(astmodulestate(module)->id);
- Py_CLEAR(astmodulestate(module)->ifs);
- Py_CLEAR(astmodulestate(module)->is_async);
- Py_CLEAR(astmodulestate(module)->items);
- Py_CLEAR(astmodulestate(module)->iter);
- Py_CLEAR(astmodulestate(module)->key);
- Py_CLEAR(astmodulestate(module)->keys);
- Py_CLEAR(astmodulestate(module)->keyword_type);
- Py_CLEAR(astmodulestate(module)->keywords);
- Py_CLEAR(astmodulestate(module)->kind);
- Py_CLEAR(astmodulestate(module)->kw_defaults);
- Py_CLEAR(astmodulestate(module)->kwarg);
- Py_CLEAR(astmodulestate(module)->kwonlyargs);
- Py_CLEAR(astmodulestate(module)->left);
- Py_CLEAR(astmodulestate(module)->level);
- Py_CLEAR(astmodulestate(module)->lineno);
- Py_CLEAR(astmodulestate(module)->lower);
- Py_CLEAR(astmodulestate(module)->mod_type);
- Py_CLEAR(astmodulestate(module)->module);
- Py_CLEAR(astmodulestate(module)->msg);
- Py_CLEAR(astmodulestate(module)->name);
- Py_CLEAR(astmodulestate(module)->names);
- Py_CLEAR(astmodulestate(module)->op);
- Py_CLEAR(astmodulestate(module)->operand);
- Py_CLEAR(astmodulestate(module)->operator_type);
- Py_CLEAR(astmodulestate(module)->ops);
- Py_CLEAR(astmodulestate(module)->optional_vars);
- Py_CLEAR(astmodulestate(module)->orelse);
- Py_CLEAR(astmodulestate(module)->posonlyargs);
- Py_CLEAR(astmodulestate(module)->returns);
- Py_CLEAR(astmodulestate(module)->right);
- Py_CLEAR(astmodulestate(module)->simple);
- Py_CLEAR(astmodulestate(module)->slice);
- Py_CLEAR(astmodulestate(module)->step);
- Py_CLEAR(astmodulestate(module)->stmt_type);
- Py_CLEAR(astmodulestate(module)->tag);
- Py_CLEAR(astmodulestate(module)->target);
- Py_CLEAR(astmodulestate(module)->targets);
- Py_CLEAR(astmodulestate(module)->test);
- Py_CLEAR(astmodulestate(module)->type);
- Py_CLEAR(astmodulestate(module)->type_comment);
- Py_CLEAR(astmodulestate(module)->type_ignore_type);
- Py_CLEAR(astmodulestate(module)->type_ignores);
- Py_CLEAR(astmodulestate(module)->unaryop_type);
- Py_CLEAR(astmodulestate(module)->upper);
- Py_CLEAR(astmodulestate(module)->value);
- Py_CLEAR(astmodulestate(module)->values);
- Py_CLEAR(astmodulestate(module)->vararg);
- Py_CLEAR(astmodulestate(module)->withitem_type);
+ astmodulestate *state = get_ast_state(module);
+ Py_CLEAR(state->AST_type);
+ Py_CLEAR(state->Add_singleton);
+ Py_CLEAR(state->Add_type);
+ Py_CLEAR(state->And_singleton);
+ Py_CLEAR(state->And_type);
+ Py_CLEAR(state->AnnAssign_type);
+ Py_CLEAR(state->Assert_type);
+ Py_CLEAR(state->Assign_type);
+ Py_CLEAR(state->AsyncFor_type);
+ Py_CLEAR(state->AsyncFunctionDef_type);
+ Py_CLEAR(state->AsyncWith_type);
+ Py_CLEAR(state->Attribute_type);
+ Py_CLEAR(state->AugAssign_type);
+ Py_CLEAR(state->Await_type);
+ Py_CLEAR(state->BinOp_type);
+ Py_CLEAR(state->BitAnd_singleton);
+ Py_CLEAR(state->BitAnd_type);
+ Py_CLEAR(state->BitOr_singleton);
+ Py_CLEAR(state->BitOr_type);
+ Py_CLEAR(state->BitXor_singleton);
+ Py_CLEAR(state->BitXor_type);
+ Py_CLEAR(state->BoolOp_type);
+ Py_CLEAR(state->Break_type);
+ Py_CLEAR(state->Call_type);
+ Py_CLEAR(state->ClassDef_type);
+ Py_CLEAR(state->Compare_type);
+ Py_CLEAR(state->Constant_type);
+ Py_CLEAR(state->Continue_type);
+ Py_CLEAR(state->Del_singleton);
+ Py_CLEAR(state->Del_type);
+ Py_CLEAR(state->Delete_type);
+ Py_CLEAR(state->DictComp_type);
+ Py_CLEAR(state->Dict_type);
+ Py_CLEAR(state->Div_singleton);
+ Py_CLEAR(state->Div_type);
+ Py_CLEAR(state->Eq_singleton);
+ Py_CLEAR(state->Eq_type);
+ Py_CLEAR(state->ExceptHandler_type);
+ Py_CLEAR(state->Expr_type);
+ Py_CLEAR(state->Expression_type);
+ Py_CLEAR(state->FloorDiv_singleton);
+ Py_CLEAR(state->FloorDiv_type);
+ Py_CLEAR(state->For_type);
+ Py_CLEAR(state->FormattedValue_type);
+ Py_CLEAR(state->FunctionDef_type);
+ Py_CLEAR(state->FunctionType_type);
+ Py_CLEAR(state->GeneratorExp_type);
+ Py_CLEAR(state->Global_type);
+ Py_CLEAR(state->GtE_singleton);
+ Py_CLEAR(state->GtE_type);
+ Py_CLEAR(state->Gt_singleton);
+ Py_CLEAR(state->Gt_type);
+ Py_CLEAR(state->IfExp_type);
+ Py_CLEAR(state->If_type);
+ Py_CLEAR(state->ImportFrom_type);
+ Py_CLEAR(state->Import_type);
+ Py_CLEAR(state->In_singleton);
+ Py_CLEAR(state->In_type);
+ Py_CLEAR(state->Interactive_type);
+ Py_CLEAR(state->Invert_singleton);
+ Py_CLEAR(state->Invert_type);
+ Py_CLEAR(state->IsNot_singleton);
+ Py_CLEAR(state->IsNot_type);
+ Py_CLEAR(state->Is_singleton);
+ Py_CLEAR(state->Is_type);
+ Py_CLEAR(state->JoinedStr_type);
+ Py_CLEAR(state->LShift_singleton);
+ Py_CLEAR(state->LShift_type);
+ Py_CLEAR(state->Lambda_type);
+ Py_CLEAR(state->ListComp_type);
+ Py_CLEAR(state->List_type);
+ Py_CLEAR(state->Load_singleton);
+ Py_CLEAR(state->Load_type);
+ Py_CLEAR(state->LtE_singleton);
+ Py_CLEAR(state->LtE_type);
+ Py_CLEAR(state->Lt_singleton);
+ Py_CLEAR(state->Lt_type);
+ Py_CLEAR(state->MatMult_singleton);
+ Py_CLEAR(state->MatMult_type);
+ Py_CLEAR(state->Mod_singleton);
+ Py_CLEAR(state->Mod_type);
+ Py_CLEAR(state->Module_type);
+ Py_CLEAR(state->Mult_singleton);
+ Py_CLEAR(state->Mult_type);
+ Py_CLEAR(state->Name_type);
+ Py_CLEAR(state->NamedExpr_type);
+ Py_CLEAR(state->Nonlocal_type);
+ Py_CLEAR(state->NotEq_singleton);
+ Py_CLEAR(state->NotEq_type);
+ Py_CLEAR(state->NotIn_singleton);
+ Py_CLEAR(state->NotIn_type);
+ Py_CLEAR(state->Not_singleton);
+ Py_CLEAR(state->Not_type);
+ Py_CLEAR(state->Or_singleton);
+ Py_CLEAR(state->Or_type);
+ Py_CLEAR(state->Pass_type);
+ Py_CLEAR(state->Pow_singleton);
+ Py_CLEAR(state->Pow_type);
+ Py_CLEAR(state->RShift_singleton);
+ Py_CLEAR(state->RShift_type);
+ Py_CLEAR(state->Raise_type);
+ Py_CLEAR(state->Return_type);
+ Py_CLEAR(state->SetComp_type);
+ Py_CLEAR(state->Set_type);
+ Py_CLEAR(state->Slice_type);
+ Py_CLEAR(state->Starred_type);
+ Py_CLEAR(state->Store_singleton);
+ Py_CLEAR(state->Store_type);
+ Py_CLEAR(state->Sub_singleton);
+ Py_CLEAR(state->Sub_type);
+ Py_CLEAR(state->Subscript_type);
+ Py_CLEAR(state->Try_type);
+ Py_CLEAR(state->Tuple_type);
+ Py_CLEAR(state->TypeIgnore_type);
+ Py_CLEAR(state->UAdd_singleton);
+ Py_CLEAR(state->UAdd_type);
+ Py_CLEAR(state->USub_singleton);
+ Py_CLEAR(state->USub_type);
+ Py_CLEAR(state->UnaryOp_type);
+ Py_CLEAR(state->While_type);
+ Py_CLEAR(state->With_type);
+ Py_CLEAR(state->YieldFrom_type);
+ Py_CLEAR(state->Yield_type);
+ Py_CLEAR(state->__dict__);
+ Py_CLEAR(state->__doc__);
+ Py_CLEAR(state->__module__);
+ Py_CLEAR(state->_attributes);
+ Py_CLEAR(state->_fields);
+ Py_CLEAR(state->alias_type);
+ Py_CLEAR(state->annotation);
+ Py_CLEAR(state->arg);
+ Py_CLEAR(state->arg_type);
+ Py_CLEAR(state->args);
+ Py_CLEAR(state->argtypes);
+ Py_CLEAR(state->arguments_type);
+ Py_CLEAR(state->asname);
+ Py_CLEAR(state->ast);
+ Py_CLEAR(state->attr);
+ Py_CLEAR(state->bases);
+ Py_CLEAR(state->body);
+ Py_CLEAR(state->boolop_type);
+ Py_CLEAR(state->cause);
+ Py_CLEAR(state->cmpop_type);
+ Py_CLEAR(state->col_offset);
+ Py_CLEAR(state->comparators);
+ Py_CLEAR(state->comprehension_type);
+ Py_CLEAR(state->context_expr);
+ Py_CLEAR(state->conversion);
+ Py_CLEAR(state->ctx);
+ Py_CLEAR(state->decorator_list);
+ Py_CLEAR(state->defaults);
+ Py_CLEAR(state->elt);
+ Py_CLEAR(state->elts);
+ Py_CLEAR(state->end_col_offset);
+ Py_CLEAR(state->end_lineno);
+ Py_CLEAR(state->exc);
+ Py_CLEAR(state->excepthandler_type);
+ Py_CLEAR(state->expr_context_type);
+ Py_CLEAR(state->expr_type);
+ Py_CLEAR(state->finalbody);
+ Py_CLEAR(state->format_spec);
+ Py_CLEAR(state->func);
+ Py_CLEAR(state->generators);
+ Py_CLEAR(state->handlers);
+ Py_CLEAR(state->id);
+ Py_CLEAR(state->ifs);
+ Py_CLEAR(state->is_async);
+ Py_CLEAR(state->items);
+ Py_CLEAR(state->iter);
+ Py_CLEAR(state->key);
+ Py_CLEAR(state->keys);
+ Py_CLEAR(state->keyword_type);
+ Py_CLEAR(state->keywords);
+ Py_CLEAR(state->kind);
+ Py_CLEAR(state->kw_defaults);
+ Py_CLEAR(state->kwarg);
+ Py_CLEAR(state->kwonlyargs);
+ Py_CLEAR(state->left);
+ Py_CLEAR(state->level);
+ Py_CLEAR(state->lineno);
+ Py_CLEAR(state->lower);
+ Py_CLEAR(state->mod_type);
+ Py_CLEAR(state->module);
+ Py_CLEAR(state->msg);
+ Py_CLEAR(state->name);
+ Py_CLEAR(state->names);
+ Py_CLEAR(state->op);
+ Py_CLEAR(state->operand);
+ Py_CLEAR(state->operator_type);
+ Py_CLEAR(state->ops);
+ Py_CLEAR(state->optional_vars);
+ Py_CLEAR(state->orelse);
+ Py_CLEAR(state->posonlyargs);
+ Py_CLEAR(state->returns);
+ Py_CLEAR(state->right);
+ Py_CLEAR(state->simple);
+ Py_CLEAR(state->slice);
+ Py_CLEAR(state->step);
+ Py_CLEAR(state->stmt_type);
+ Py_CLEAR(state->tag);
+ Py_CLEAR(state->target);
+ Py_CLEAR(state->targets);
+ Py_CLEAR(state->test);
+ Py_CLEAR(state->type);
+ Py_CLEAR(state->type_comment);
+ Py_CLEAR(state->type_ignore_type);
+ Py_CLEAR(state->type_ignores);
+ Py_CLEAR(state->unaryop_type);
+ Py_CLEAR(state->upper);
+ Py_CLEAR(state->value);
+ Py_CLEAR(state->values);
+ Py_CLEAR(state->vararg);
+ Py_CLEAR(state->withitem_type);
return 0;
}
static int astmodule_traverse(PyObject *module, visitproc visit, void* arg)
{
- Py_VISIT(astmodulestate(module)->AST_type);
- Py_VISIT(astmodulestate(module)->Add_singleton);
- Py_VISIT(astmodulestate(module)->Add_type);
- Py_VISIT(astmodulestate(module)->And_singleton);
- Py_VISIT(astmodulestate(module)->And_type);
- Py_VISIT(astmodulestate(module)->AnnAssign_type);
- Py_VISIT(astmodulestate(module)->Assert_type);
- Py_VISIT(astmodulestate(module)->Assign_type);
- Py_VISIT(astmodulestate(module)->AsyncFor_type);
- Py_VISIT(astmodulestate(module)->AsyncFunctionDef_type);
- Py_VISIT(astmodulestate(module)->AsyncWith_type);
- Py_VISIT(astmodulestate(module)->Attribute_type);
- Py_VISIT(astmodulestate(module)->AugAssign_type);
- Py_VISIT(astmodulestate(module)->Await_type);
- Py_VISIT(astmodulestate(module)->BinOp_type);
- Py_VISIT(astmodulestate(module)->BitAnd_singleton);
- Py_VISIT(astmodulestate(module)->BitAnd_type);
- Py_VISIT(astmodulestate(module)->BitOr_singleton);
- Py_VISIT(astmodulestate(module)->BitOr_type);
- Py_VISIT(astmodulestate(module)->BitXor_singleton);
- Py_VISIT(astmodulestate(module)->BitXor_type);
- Py_VISIT(astmodulestate(module)->BoolOp_type);
- Py_VISIT(astmodulestate(module)->Break_type);
- Py_VISIT(astmodulestate(module)->Call_type);
- Py_VISIT(astmodulestate(module)->ClassDef_type);
- Py_VISIT(astmodulestate(module)->Compare_type);
- Py_VISIT(astmodulestate(module)->Constant_type);
- Py_VISIT(astmodulestate(module)->Continue_type);
- Py_VISIT(astmodulestate(module)->Del_singleton);
- Py_VISIT(astmodulestate(module)->Del_type);
- Py_VISIT(astmodulestate(module)->Delete_type);
- Py_VISIT(astmodulestate(module)->DictComp_type);
- Py_VISIT(astmodulestate(module)->Dict_type);
- Py_VISIT(astmodulestate(module)->Div_singleton);
- Py_VISIT(astmodulestate(module)->Div_type);
- Py_VISIT(astmodulestate(module)->Eq_singleton);
- Py_VISIT(astmodulestate(module)->Eq_type);
- Py_VISIT(astmodulestate(module)->ExceptHandler_type);
- Py_VISIT(astmodulestate(module)->Expr_type);
- Py_VISIT(astmodulestate(module)->Expression_type);
- Py_VISIT(astmodulestate(module)->FloorDiv_singleton);
- Py_VISIT(astmodulestate(module)->FloorDiv_type);
- Py_VISIT(astmodulestate(module)->For_type);
- Py_VISIT(astmodulestate(module)->FormattedValue_type);
- Py_VISIT(astmodulestate(module)->FunctionDef_type);
- Py_VISIT(astmodulestate(module)->FunctionType_type);
- Py_VISIT(astmodulestate(module)->GeneratorExp_type);
- Py_VISIT(astmodulestate(module)->Global_type);
- Py_VISIT(astmodulestate(module)->GtE_singleton);
- Py_VISIT(astmodulestate(module)->GtE_type);
- Py_VISIT(astmodulestate(module)->Gt_singleton);
- Py_VISIT(astmodulestate(module)->Gt_type);
- Py_VISIT(astmodulestate(module)->IfExp_type);
- Py_VISIT(astmodulestate(module)->If_type);
- Py_VISIT(astmodulestate(module)->ImportFrom_type);
- Py_VISIT(astmodulestate(module)->Import_type);
- Py_VISIT(astmodulestate(module)->In_singleton);
- Py_VISIT(astmodulestate(module)->In_type);
- Py_VISIT(astmodulestate(module)->Interactive_type);
- Py_VISIT(astmodulestate(module)->Invert_singleton);
- Py_VISIT(astmodulestate(module)->Invert_type);
- Py_VISIT(astmodulestate(module)->IsNot_singleton);
- Py_VISIT(astmodulestate(module)->IsNot_type);
- Py_VISIT(astmodulestate(module)->Is_singleton);
- Py_VISIT(astmodulestate(module)->Is_type);
- Py_VISIT(astmodulestate(module)->JoinedStr_type);
- Py_VISIT(astmodulestate(module)->LShift_singleton);
- Py_VISIT(astmodulestate(module)->LShift_type);
- Py_VISIT(astmodulestate(module)->Lambda_type);
- Py_VISIT(astmodulestate(module)->ListComp_type);
- Py_VISIT(astmodulestate(module)->List_type);
- Py_VISIT(astmodulestate(module)->Load_singleton);
- Py_VISIT(astmodulestate(module)->Load_type);
- Py_VISIT(astmodulestate(module)->LtE_singleton);
- Py_VISIT(astmodulestate(module)->LtE_type);
- Py_VISIT(astmodulestate(module)->Lt_singleton);
- Py_VISIT(astmodulestate(module)->Lt_type);
- Py_VISIT(astmodulestate(module)->MatMult_singleton);
- Py_VISIT(astmodulestate(module)->MatMult_type);
- Py_VISIT(astmodulestate(module)->Mod_singleton);
- Py_VISIT(astmodulestate(module)->Mod_type);
- Py_VISIT(astmodulestate(module)->Module_type);
- Py_VISIT(astmodulestate(module)->Mult_singleton);
- Py_VISIT(astmodulestate(module)->Mult_type);
- Py_VISIT(astmodulestate(module)->Name_type);
- Py_VISIT(astmodulestate(module)->NamedExpr_type);
- Py_VISIT(astmodulestate(module)->Nonlocal_type);
- Py_VISIT(astmodulestate(module)->NotEq_singleton);
- Py_VISIT(astmodulestate(module)->NotEq_type);
- Py_VISIT(astmodulestate(module)->NotIn_singleton);
- Py_VISIT(astmodulestate(module)->NotIn_type);
- Py_VISIT(astmodulestate(module)->Not_singleton);
- Py_VISIT(astmodulestate(module)->Not_type);
- Py_VISIT(astmodulestate(module)->Or_singleton);
- Py_VISIT(astmodulestate(module)->Or_type);
- Py_VISIT(astmodulestate(module)->Pass_type);
- Py_VISIT(astmodulestate(module)->Pow_singleton);
- Py_VISIT(astmodulestate(module)->Pow_type);
- Py_VISIT(astmodulestate(module)->RShift_singleton);
- Py_VISIT(astmodulestate(module)->RShift_type);
- Py_VISIT(astmodulestate(module)->Raise_type);
- Py_VISIT(astmodulestate(module)->Return_type);
- Py_VISIT(astmodulestate(module)->SetComp_type);
- Py_VISIT(astmodulestate(module)->Set_type);
- Py_VISIT(astmodulestate(module)->Slice_type);
- Py_VISIT(astmodulestate(module)->Starred_type);
- Py_VISIT(astmodulestate(module)->Store_singleton);
- Py_VISIT(astmodulestate(module)->Store_type);
- Py_VISIT(astmodulestate(module)->Sub_singleton);
- Py_VISIT(astmodulestate(module)->Sub_type);
- Py_VISIT(astmodulestate(module)->Subscript_type);
- Py_VISIT(astmodulestate(module)->Try_type);
- Py_VISIT(astmodulestate(module)->Tuple_type);
- Py_VISIT(astmodulestate(module)->TypeIgnore_type);
- Py_VISIT(astmodulestate(module)->UAdd_singleton);
- Py_VISIT(astmodulestate(module)->UAdd_type);
- Py_VISIT(astmodulestate(module)->USub_singleton);
- Py_VISIT(astmodulestate(module)->USub_type);
- Py_VISIT(astmodulestate(module)->UnaryOp_type);
- Py_VISIT(astmodulestate(module)->While_type);
- Py_VISIT(astmodulestate(module)->With_type);
- Py_VISIT(astmodulestate(module)->YieldFrom_type);
- Py_VISIT(astmodulestate(module)->Yield_type);
- Py_VISIT(astmodulestate(module)->__dict__);
- Py_VISIT(astmodulestate(module)->__doc__);
- Py_VISIT(astmodulestate(module)->__module__);
- Py_VISIT(astmodulestate(module)->_attributes);
- Py_VISIT(astmodulestate(module)->_fields);
- Py_VISIT(astmodulestate(module)->alias_type);
- Py_VISIT(astmodulestate(module)->annotation);
- Py_VISIT(astmodulestate(module)->arg);
- Py_VISIT(astmodulestate(module)->arg_type);
- Py_VISIT(astmodulestate(module)->args);
- Py_VISIT(astmodulestate(module)->argtypes);
- Py_VISIT(astmodulestate(module)->arguments_type);
- Py_VISIT(astmodulestate(module)->asname);
- Py_VISIT(astmodulestate(module)->ast);
- Py_VISIT(astmodulestate(module)->attr);
- Py_VISIT(astmodulestate(module)->bases);
- Py_VISIT(astmodulestate(module)->body);
- Py_VISIT(astmodulestate(module)->boolop_type);
- Py_VISIT(astmodulestate(module)->cause);
- Py_VISIT(astmodulestate(module)->cmpop_type);
- Py_VISIT(astmodulestate(module)->col_offset);
- Py_VISIT(astmodulestate(module)->comparators);
- Py_VISIT(astmodulestate(module)->comprehension_type);
- Py_VISIT(astmodulestate(module)->context_expr);
- Py_VISIT(astmodulestate(module)->conversion);
- Py_VISIT(astmodulestate(module)->ctx);
- Py_VISIT(astmodulestate(module)->decorator_list);
- Py_VISIT(astmodulestate(module)->defaults);
- Py_VISIT(astmodulestate(module)->elt);
- Py_VISIT(astmodulestate(module)->elts);
- Py_VISIT(astmodulestate(module)->end_col_offset);
- Py_VISIT(astmodulestate(module)->end_lineno);
- Py_VISIT(astmodulestate(module)->exc);
- Py_VISIT(astmodulestate(module)->excepthandler_type);
- Py_VISIT(astmodulestate(module)->expr_context_type);
- Py_VISIT(astmodulestate(module)->expr_type);
- Py_VISIT(astmodulestate(module)->finalbody);
- Py_VISIT(astmodulestate(module)->format_spec);
- Py_VISIT(astmodulestate(module)->func);
- Py_VISIT(astmodulestate(module)->generators);
- Py_VISIT(astmodulestate(module)->handlers);
- Py_VISIT(astmodulestate(module)->id);
- Py_VISIT(astmodulestate(module)->ifs);
- Py_VISIT(astmodulestate(module)->is_async);
- Py_VISIT(astmodulestate(module)->items);
- Py_VISIT(astmodulestate(module)->iter);
- Py_VISIT(astmodulestate(module)->key);
- Py_VISIT(astmodulestate(module)->keys);
- Py_VISIT(astmodulestate(module)->keyword_type);
- Py_VISIT(astmodulestate(module)->keywords);
- Py_VISIT(astmodulestate(module)->kind);
- Py_VISIT(astmodulestate(module)->kw_defaults);
- Py_VISIT(astmodulestate(module)->kwarg);
- Py_VISIT(astmodulestate(module)->kwonlyargs);
- Py_VISIT(astmodulestate(module)->left);
- Py_VISIT(astmodulestate(module)->level);
- Py_VISIT(astmodulestate(module)->lineno);
- Py_VISIT(astmodulestate(module)->lower);
- Py_VISIT(astmodulestate(module)->mod_type);
- Py_VISIT(astmodulestate(module)->module);
- Py_VISIT(astmodulestate(module)->msg);
- Py_VISIT(astmodulestate(module)->name);
- Py_VISIT(astmodulestate(module)->names);
- Py_VISIT(astmodulestate(module)->op);
- Py_VISIT(astmodulestate(module)->operand);
- Py_VISIT(astmodulestate(module)->operator_type);
- Py_VISIT(astmodulestate(module)->ops);
- Py_VISIT(astmodulestate(module)->optional_vars);
- Py_VISIT(astmodulestate(module)->orelse);
- Py_VISIT(astmodulestate(module)->posonlyargs);
- Py_VISIT(astmodulestate(module)->returns);
- Py_VISIT(astmodulestate(module)->right);
- Py_VISIT(astmodulestate(module)->simple);
- Py_VISIT(astmodulestate(module)->slice);
- Py_VISIT(astmodulestate(module)->step);
- Py_VISIT(astmodulestate(module)->stmt_type);
- Py_VISIT(astmodulestate(module)->tag);
- Py_VISIT(astmodulestate(module)->target);
- Py_VISIT(astmodulestate(module)->targets);
- Py_VISIT(astmodulestate(module)->test);
- Py_VISIT(astmodulestate(module)->type);
- Py_VISIT(astmodulestate(module)->type_comment);
- Py_VISIT(astmodulestate(module)->type_ignore_type);
- Py_VISIT(astmodulestate(module)->type_ignores);
- Py_VISIT(astmodulestate(module)->unaryop_type);
- Py_VISIT(astmodulestate(module)->upper);
- Py_VISIT(astmodulestate(module)->value);
- Py_VISIT(astmodulestate(module)->values);
- Py_VISIT(astmodulestate(module)->vararg);
- Py_VISIT(astmodulestate(module)->withitem_type);
+ astmodulestate *state = get_ast_state(module);
+ Py_VISIT(state->AST_type);
+ Py_VISIT(state->Add_singleton);
+ Py_VISIT(state->Add_type);
+ Py_VISIT(state->And_singleton);
+ Py_VISIT(state->And_type);
+ Py_VISIT(state->AnnAssign_type);
+ Py_VISIT(state->Assert_type);
+ Py_VISIT(state->Assign_type);
+ Py_VISIT(state->AsyncFor_type);
+ Py_VISIT(state->AsyncFunctionDef_type);
+ Py_VISIT(state->AsyncWith_type);
+ Py_VISIT(state->Attribute_type);
+ Py_VISIT(state->AugAssign_type);
+ Py_VISIT(state->Await_type);
+ Py_VISIT(state->BinOp_type);
+ Py_VISIT(state->BitAnd_singleton);
+ Py_VISIT(state->BitAnd_type);
+ Py_VISIT(state->BitOr_singleton);
+ Py_VISIT(state->BitOr_type);
+ Py_VISIT(state->BitXor_singleton);
+ Py_VISIT(state->BitXor_type);
+ Py_VISIT(state->BoolOp_type);
+ Py_VISIT(state->Break_type);
+ Py_VISIT(state->Call_type);
+ Py_VISIT(state->ClassDef_type);
+ Py_VISIT(state->Compare_type);
+ Py_VISIT(state->Constant_type);
+ Py_VISIT(state->Continue_type);
+ Py_VISIT(state->Del_singleton);
+ Py_VISIT(state->Del_type);
+ Py_VISIT(state->Delete_type);
+ Py_VISIT(state->DictComp_type);
+ Py_VISIT(state->Dict_type);
+ Py_VISIT(state->Div_singleton);
+ Py_VISIT(state->Div_type);
+ Py_VISIT(state->Eq_singleton);
+ Py_VISIT(state->Eq_type);
+ Py_VISIT(state->ExceptHandler_type);
+ Py_VISIT(state->Expr_type);
+ Py_VISIT(state->Expression_type);
+ Py_VISIT(state->FloorDiv_singleton);
+ Py_VISIT(state->FloorDiv_type);
+ Py_VISIT(state->For_type);
+ Py_VISIT(state->FormattedValue_type);
+ Py_VISIT(state->FunctionDef_type);
+ Py_VISIT(state->FunctionType_type);
+ Py_VISIT(state->GeneratorExp_type);
+ Py_VISIT(state->Global_type);
+ Py_VISIT(state->GtE_singleton);
+ Py_VISIT(state->GtE_type);
+ Py_VISIT(state->Gt_singleton);
+ Py_VISIT(state->Gt_type);
+ Py_VISIT(state->IfExp_type);
+ Py_VISIT(state->If_type);
+ Py_VISIT(state->ImportFrom_type);
+ Py_VISIT(state->Import_type);
+ Py_VISIT(state->In_singleton);
+ Py_VISIT(state->In_type);
+ Py_VISIT(state->Interactive_type);
+ Py_VISIT(state->Invert_singleton);
+ Py_VISIT(state->Invert_type);
+ Py_VISIT(state->IsNot_singleton);
+ Py_VISIT(state->IsNot_type);
+ Py_VISIT(state->Is_singleton);
+ Py_VISIT(state->Is_type);
+ Py_VISIT(state->JoinedStr_type);
+ Py_VISIT(state->LShift_singleton);
+ Py_VISIT(state->LShift_type);
+ Py_VISIT(state->Lambda_type);
+ Py_VISIT(state->ListComp_type);
+ Py_VISIT(state->List_type);
+ Py_VISIT(state->Load_singleton);
+ Py_VISIT(state->Load_type);
+ Py_VISIT(state->LtE_singleton);
+ Py_VISIT(state->LtE_type);
+ Py_VISIT(state->Lt_singleton);
+ Py_VISIT(state->Lt_type);
+ Py_VISIT(state->MatMult_singleton);
+ Py_VISIT(state->MatMult_type);
+ Py_VISIT(state->Mod_singleton);
+ Py_VISIT(state->Mod_type);
+ Py_VISIT(state->Module_type);
+ Py_VISIT(state->Mult_singleton);
+ Py_VISIT(state->Mult_type);
+ Py_VISIT(state->Name_type);
+ Py_VISIT(state->NamedExpr_type);
+ Py_VISIT(state->Nonlocal_type);
+ Py_VISIT(state->NotEq_singleton);
+ Py_VISIT(state->NotEq_type);
+ Py_VISIT(state->NotIn_singleton);
+ Py_VISIT(state->NotIn_type);
+ Py_VISIT(state->Not_singleton);
+ Py_VISIT(state->Not_type);
+ Py_VISIT(state->Or_singleton);
+ Py_VISIT(state->Or_type);
+ Py_VISIT(state->Pass_type);
+ Py_VISIT(state->Pow_singleton);
+ Py_VISIT(state->Pow_type);
+ Py_VISIT(state->RShift_singleton);
+ Py_VISIT(state->RShift_type);
+ Py_VISIT(state->Raise_type);
+ Py_VISIT(state->Return_type);
+ Py_VISIT(state->SetComp_type);
+ Py_VISIT(state->Set_type);
+ Py_VISIT(state->Slice_type);
+ Py_VISIT(state->Starred_type);
+ Py_VISIT(state->Store_singleton);
+ Py_VISIT(state->Store_type);
+ Py_VISIT(state->Sub_singleton);
+ Py_VISIT(state->Sub_type);
+ Py_VISIT(state->Subscript_type);
+ Py_VISIT(state->Try_type);
+ Py_VISIT(state->Tuple_type);
+ Py_VISIT(state->TypeIgnore_type);
+ Py_VISIT(state->UAdd_singleton);
+ Py_VISIT(state->UAdd_type);
+ Py_VISIT(state->USub_singleton);
+ Py_VISIT(state->USub_type);
+ Py_VISIT(state->UnaryOp_type);
+ Py_VISIT(state->While_type);
+ Py_VISIT(state->With_type);
+ Py_VISIT(state->YieldFrom_type);
+ Py_VISIT(state->Yield_type);
+ Py_VISIT(state->__dict__);
+ Py_VISIT(state->__doc__);
+ Py_VISIT(state->__module__);
+ Py_VISIT(state->_attributes);
+ Py_VISIT(state->_fields);
+ Py_VISIT(state->alias_type);
+ Py_VISIT(state->annotation);
+ Py_VISIT(state->arg);
+ Py_VISIT(state->arg_type);
+ Py_VISIT(state->args);
+ Py_VISIT(state->argtypes);
+ Py_VISIT(state->arguments_type);
+ Py_VISIT(state->asname);
+ Py_VISIT(state->ast);
+ Py_VISIT(state->attr);
+ Py_VISIT(state->bases);
+ Py_VISIT(state->body);
+ Py_VISIT(state->boolop_type);
+ Py_VISIT(state->cause);
+ Py_VISIT(state->cmpop_type);
+ Py_VISIT(state->col_offset);
+ Py_VISIT(state->comparators);
+ Py_VISIT(state->comprehension_type);
+ Py_VISIT(state->context_expr);
+ Py_VISIT(state->conversion);
+ Py_VISIT(state->ctx);
+ Py_VISIT(state->decorator_list);
+ Py_VISIT(state->defaults);
+ Py_VISIT(state->elt);
+ Py_VISIT(state->elts);
+ Py_VISIT(state->end_col_offset);
+ Py_VISIT(state->end_lineno);
+ Py_VISIT(state->exc);
+ Py_VISIT(state->excepthandler_type);
+ Py_VISIT(state->expr_context_type);
+ Py_VISIT(state->expr_type);
+ Py_VISIT(state->finalbody);
+ Py_VISIT(state->format_spec);
+ Py_VISIT(state->func);
+ Py_VISIT(state->generators);
+ Py_VISIT(state->handlers);
+ Py_VISIT(state->id);
+ Py_VISIT(state->ifs);
+ Py_VISIT(state->is_async);
+ Py_VISIT(state->items);
+ Py_VISIT(state->iter);
+ Py_VISIT(state->key);
+ Py_VISIT(state->keys);
+ Py_VISIT(state->keyword_type);
+ Py_VISIT(state->keywords);
+ Py_VISIT(state->kind);
+ Py_VISIT(state->kw_defaults);
+ Py_VISIT(state->kwarg);
+ Py_VISIT(state->kwonlyargs);
+ Py_VISIT(state->left);
+ Py_VISIT(state->level);
+ Py_VISIT(state->lineno);
+ Py_VISIT(state->lower);
+ Py_VISIT(state->mod_type);
+ Py_VISIT(state->module);
+ Py_VISIT(state->msg);
+ Py_VISIT(state->name);
+ Py_VISIT(state->names);
+ Py_VISIT(state->op);
+ Py_VISIT(state->operand);
+ Py_VISIT(state->operator_type);
+ Py_VISIT(state->ops);
+ Py_VISIT(state->optional_vars);
+ Py_VISIT(state->orelse);
+ Py_VISIT(state->posonlyargs);
+ Py_VISIT(state->returns);
+ Py_VISIT(state->right);
+ Py_VISIT(state->simple);
+ Py_VISIT(state->slice);
+ Py_VISIT(state->step);
+ Py_VISIT(state->stmt_type);
+ Py_VISIT(state->tag);
+ Py_VISIT(state->target);
+ Py_VISIT(state->targets);
+ Py_VISIT(state->test);
+ Py_VISIT(state->type);
+ Py_VISIT(state->type_comment);
+ Py_VISIT(state->type_ignore_type);
+ Py_VISIT(state->type_ignores);
+ Py_VISIT(state->unaryop_type);
+ Py_VISIT(state->upper);
+ Py_VISIT(state->value);
+ Py_VISIT(state->values);
+ Py_VISIT(state->vararg);
+ Py_VISIT(state->withitem_type);
return 0;
}
@@ -680,11 +689,10 @@ static struct PyModuleDef _astmodule = {
astmodule_free,
};
-#define astmodulestate_global ((astmodulestate *)PyModule_GetState(PyState_FindModule(&_astmodule)))
+#define astmodulestate_global get_ast_state(PyState_FindModule(&_astmodule))
-static int init_identifiers(void)
+static int init_identifiers(astmodulestate *state)
{
- astmodulestate *state = astmodulestate_global;
if ((state->__dict__ = PyUnicode_InternFromString("__dict__")) == NULL) return 0;
if ((state->__doc__ = PyUnicode_InternFromString("__doc__")) == NULL) return 0;
if ((state->__module__ = PyUnicode_InternFromString("__module__")) == NULL) return 0;
@@ -762,7 +770,7 @@ static int init_identifiers(void)
return 1;
};
-static PyObject* ast2obj_mod(void*);
+static PyObject* ast2obj_mod(astmodulestate *state, void*);
static const char * const Module_fields[]={
"body",
"type_ignores",
@@ -783,7 +791,7 @@ static const char * const stmt_attributes[] = {
"end_lineno",
"end_col_offset",
};
-static PyObject* ast2obj_stmt(void*);
+static PyObject* ast2obj_stmt(astmodulestate *state, void*);
static const char * const FunctionDef_fields[]={
"name",
"args",
@@ -900,7 +908,7 @@ static const char * const expr_attributes[] = {
"end_lineno",
"end_col_offset",
};
-static PyObject* ast2obj_expr(void*);
+static PyObject* ast2obj_expr(astmodulestate *state, void*);
static const char * const BoolOp_fields[]={
"op",
"values",
@@ -1013,12 +1021,12 @@ static const char * const Slice_fields[]={
"upper",
"step",
};
-static PyObject* ast2obj_expr_context(expr_context_ty);
-static PyObject* ast2obj_boolop(boolop_ty);
-static PyObject* ast2obj_operator(operator_ty);
-static PyObject* ast2obj_unaryop(unaryop_ty);
-static PyObject* ast2obj_cmpop(cmpop_ty);
-static PyObject* ast2obj_comprehension(void*);
+static PyObject* ast2obj_expr_context(astmodulestate *state, expr_context_ty);
+static PyObject* ast2obj_boolop(astmodulestate *state, boolop_ty);
+static PyObject* ast2obj_operator(astmodulestate *state, operator_ty);
+static PyObject* ast2obj_unaryop(astmodulestate *state, unaryop_ty);
+static PyObject* ast2obj_cmpop(astmodulestate *state, cmpop_ty);
+static PyObject* ast2obj_comprehension(astmodulestate *state, void*);
static const char * const comprehension_fields[]={
"target",
"iter",
@@ -1031,13 +1039,13 @@ static const char * const excepthandler_attributes[] = {
"end_lineno",
"end_col_offset",
};
-static PyObject* ast2obj_excepthandler(void*);
+static PyObject* ast2obj_excepthandler(astmodulestate *state, void*);
static const char * const ExceptHandler_fields[]={
"type",
"name",
"body",
};
-static PyObject* ast2obj_arguments(void*);
+static PyObject* ast2obj_arguments(astmodulestate *state, void*);
static const char * const arguments_fields[]={
"posonlyargs",
"args",
@@ -1047,7 +1055,7 @@ static const char * const arguments_fields[]={
"kwarg",
"defaults",
};
-static PyObject* ast2obj_arg(void*);
+static PyObject* ast2obj_arg(astmodulestate *state, void*);
static const char * const arg_attributes[] = {
"lineno",
"col_offset",
@@ -1059,7 +1067,7 @@ static const char * const arg_fields[]={
"annotation",
"type_comment",
};
-static PyObject* ast2obj_keyword(void*);
+static PyObject* ast2obj_keyword(astmodulestate *state, void*);
static const char * const keyword_attributes[] = {
"lineno",
"col_offset",
@@ -1070,17 +1078,17 @@ static const char * const keyword_fields[]={
"arg",
"value",
};
-static PyObject* ast2obj_alias(void*);
+static PyObject* ast2obj_alias(astmodulestate *state, void*);
static const char * const alias_fields[]={
"name",
"asname",
};
-static PyObject* ast2obj_withitem(void*);
+static PyObject* ast2obj_withitem(astmodulestate *state, void*);
static const char * const withitem_fields[]={
"context_expr",
"optional_vars",
};
-static PyObject* ast2obj_type_ignore(void*);
+static PyObject* ast2obj_type_ignore(astmodulestate *state, void*);
static const char * const TypeIgnore_fields[]={
"lineno",
"tag",
@@ -1127,7 +1135,8 @@ ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
Py_ssize_t i, numfields = 0;
int res = -1;
PyObject *key, *value, *fields;
- if (_PyObject_LookupAttr((PyObject*)Py_TYPE(self), astmodulestate_global->_fields, &fields) < 0) {
+ astmodulestate *state = astmodulestate_global;
+ if (_PyObject_LookupAttr((PyObject*)Py_TYPE(self), state->_fields, &fields) < 0) {
goto cleanup;
}
if (fields) {
@@ -1195,8 +1204,9 @@ ast_type_init(PyObject *self, PyObject *args, PyObject *kw)
static PyObject *
ast_type_reduce(PyObject *self, PyObject *unused)
{
+ astmodulestate *state = astmodulestate_global;
PyObject *dict;
- if (_PyObject_LookupAttr(self, astmodulestate_global->__dict__, &dict) < 0) {
+ if (_PyObject_LookupAttr(self, state->__dict__, &dict) < 0) {
return NULL;
}
if (dict) {
@@ -1245,7 +1255,8 @@ static PyType_Spec AST_type_spec = {
};
static PyObject *
-make_type(const char *type, PyObject* base, const char* const* fields, int num_fields, const char *doc)
+make_type(astmodulestate *state, const char *type, PyObject* base,
+ const char* const* fields, int num_fields, const char *doc)
{
PyObject *fnames, *result;
int i;
@@ -1261,16 +1272,16 @@ make_type(const char *type, PyObject* base, const char* const* fields, int num_f
}
result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){OOOOOs}",
type, base,
- astmodulestate_global->_fields, fnames,
- astmodulestate_global->__module__,
- astmodulestate_global->ast,
- astmodulestate_global->__doc__, doc);
+ state->_fields, fnames,
+ state->__module__,
+ state->ast,
+ state->__doc__, doc);
Py_DECREF(fnames);
return result;
}
static int
-add_attributes(PyObject *type, const char * const *attrs, int num_fields)
+add_attributes(astmodulestate *state, PyObject *type, const char * const *attrs, int num_fields)
{
int i, result;
PyObject *s, *l = PyTuple_New(num_fields);
@@ -1284,14 +1295,14 @@ add_attributes(PyObject *type, const char * const *attrs, int num_fields)
}
PyTuple_SET_ITEM(l, i, s);
}
- result = PyObject_SetAttr(type, astmodulestate_global->_attributes, l) >= 0;
+ result = PyObject_SetAttr(type, state->_attributes, l) >= 0;
Py_DECREF(l);
return result;
}
/* Conversion AST -> Python */
-static PyObject* ast2obj_list(asdl_seq *seq, PyObject* (*func)(void*))
+static PyObject* ast2obj_list(astmodulestate *state, asdl_seq *seq, PyObject* (*func)(astmodulestate *state, void*))
{
Py_ssize_t i, n = asdl_seq_LEN(seq);
PyObject *result = PyList_New(n);
@@ -1299,7 +1310,7 @@ static PyObject* ast2obj_list(asdl_seq *seq, PyObject* (*func)(void*))
if (!result)
return NULL;
for (i = 0; i < n; i++) {
- value = func(asdl_seq_GET(seq, i));
+ value = func(state, asdl_seq_GET(seq, i));
if (!value) {
Py_DECREF(result);
return NULL;
@@ -1309,7 +1320,7 @@ static PyObject* ast2obj_list(asdl_seq *seq, PyObject* (*func)(void*))
return result;
}
-static PyObject* ast2obj_object(void *o)
+static PyObject* ast2obj_object(astmodulestate *Py_UNUSED(state), void *o)
{
if (!o)
o = Py_None;
@@ -1320,14 +1331,14 @@ static PyObject* ast2obj_object(void *o)
#define ast2obj_identifier ast2obj_object
#define ast2obj_string ast2obj_object
-static PyObject* ast2obj_int(long b)
+static PyObject* ast2obj_int(astmodulestate *Py_UNUSED(state), long b)
{
return PyLong_FromLong(b);
}
/* Conversion Python -> AST */
-static int obj2ast_object(PyObject* obj, PyObject** out, PyArena* arena)
+static int obj2ast_object(astmodulestate *Py_UNUSED(state), PyObject* obj, PyObject** out, PyArena* arena)
{
if (obj == Py_None)
obj = NULL;
@@ -1342,7 +1353,7 @@ static int obj2ast_object(PyObject* obj, PyObject** out, PyArena* arena)
return 0;
}
-static int obj2ast_constant(PyObject* obj, PyObject** out, PyArena* arena)
+static int obj2ast_constant(astmodulestate *Py_UNUSED(state), PyObject* obj, PyObject** out, PyArena* arena)
{
if (PyArena_AddPyObject(arena, obj) < 0) {
*out = NULL;
@@ -1353,25 +1364,25 @@ static int obj2ast_constant(PyObject* obj, PyObject** out, PyArena* arena)
return 0;
}
-static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena)
+static int obj2ast_identifier(astmodulestate *state, PyObject* obj, PyObject** out, PyArena* arena)
{
if (!PyUnicode_CheckExact(obj) && obj != Py_None) {
PyErr_SetString(PyExc_TypeError, "AST identifier must be of type str");
return 1;
}
- return obj2ast_object(obj, out, arena);
+ return obj2ast_object(state, obj, out, arena);
}
-static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena)
+static int obj2ast_string(astmodulestate *state, PyObject* obj, PyObject** out, PyArena* arena)
{
if (!PyUnicode_CheckExact(obj) && !PyBytes_CheckExact(obj)) {
PyErr_SetString(PyExc_TypeError, "AST string must be of type str");
return 1;
}
- return obj2ast_object(obj, out, arena);
+ return obj2ast_object(state, obj, out, arena);
}
-static int obj2ast_int(PyObject* obj, int* out, PyArena* arena)
+static int obj2ast_int(astmodulestate* Py_UNUSED(state), PyObject* obj, int* out, PyArena* arena)
{
int i;
if (!PyLong_Check(obj)) {
@@ -1386,13 +1397,13 @@ static int obj2ast_int(PyObject* obj, int* out, PyArena* arena)
return 0;
}
-static int add_ast_fields(void)
+static int add_ast_fields(astmodulestate *state)
{
PyObject *empty_tuple;
empty_tuple = PyTuple_New(0);
if (!empty_tuple ||
- PyObject_SetAttrString(astmodulestate_global->AST_type, "_fields", empty_tuple) < 0 ||
- PyObject_SetAttrString(astmodulestate_global->AST_type, "_attributes", empty_tuple) < 0) {
+ PyObject_SetAttrString(state->AST_type, "_fields", empty_tuple) < 0 ||
+ PyObject_SetAttrString(state->AST_type, "_attributes", empty_tuple) < 0) {
Py_XDECREF(empty_tuple);
return -1;
}
@@ -1403,41 +1414,48 @@ static int add_ast_fields(void)
static int init_types(void)
{
- PyObject *m;
- if (PyState_FindModule(&_astmodule) == NULL) {
- m = PyModule_Create(&_astmodule);
- if (!m) return 0;
- PyState_AddModule(m, &_astmodule);
+ PyObject *module = PyState_FindModule(&_astmodule);
+ if (module == NULL) {
+ module = PyModule_Create(&_astmodule);
+ if (!module) {
+ return 0;
+ }
+ if (PyState_AddModule(module, &_astmodule) < 0) {
+ return 0;
+ }
}
- astmodulestate *state = astmodulestate_global;
+
+ astmodulestate *state = get_ast_state(module);
if (state->initialized) return 1;
- if (init_identifiers() < 0) return 0;
+ if (init_identifiers(state) < 0) return 0;
state->AST_type = PyType_FromSpec(&AST_type_spec);
if (!state->AST_type) return 0;
- if (add_ast_fields() < 0) return 0;
- state->mod_type = make_type("mod", state->AST_type, NULL, 0,
+ if (add_ast_fields(state) < 0) return 0;
+ state->mod_type = make_type(state, "mod", state->AST_type, NULL, 0,
"mod = Module(stmt* body, type_ignore* type_ignores)\n"
" | Interactive(stmt* body)\n"
" | Expression(expr body)\n"
" | FunctionType(expr* argtypes, expr returns)");
if (!state->mod_type) return 0;
- if (!add_attributes(state->mod_type, NULL, 0)) return 0;
- state->Module_type = make_type("Module", state->mod_type, Module_fields, 2,
+ if (!add_attributes(state, state->mod_type, NULL, 0)) return 0;
+ state->Module_type = make_type(state, "Module", state->mod_type,
+ Module_fields, 2,
"Module(stmt* body, type_ignore* type_ignores)");
if (!state->Module_type) return 0;
- state->Interactive_type = make_type("Interactive", state->mod_type,
+ state->Interactive_type = make_type(state, "Interactive", state->mod_type,
Interactive_fields, 1,
"Interactive(stmt* body)");
if (!state->Interactive_type) return 0;
- state->Expression_type = make_type("Expression", state->mod_type,
+ state->Expression_type = make_type(state, "Expression", state->mod_type,
Expression_fields, 1,
"Expression(expr body)");
if (!state->Expression_type) return 0;
- state->FunctionType_type = make_type("FunctionType", state->mod_type,
- FunctionType_fields, 2,
+ state->FunctionType_type = make_type(state, "FunctionType",
+ state->mod_type, FunctionType_fields,
+ 2,
"FunctionType(expr* argtypes, expr returns)");
if (!state->FunctionType_type) return 0;
- state->stmt_type = make_type("stmt", state->AST_type, NULL, 0,
+ state->stmt_type = make_type(state, "stmt", state->AST_type, NULL, 0,
"stmt = FunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment)\n"
" | AsyncFunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment)\n"
" | ClassDef(identifier name, expr* bases, keyword* keywords, stmt* body, expr* decorator_list)\n"
@@ -1464,13 +1482,13 @@ static int init_types(void)
" | Break\n"
" | Continue");
if (!state->stmt_type) return 0;
- if (!add_attributes(state->stmt_type, stmt_attributes, 4)) return 0;
+ if (!add_attributes(state, state->stmt_type, stmt_attributes, 4)) return 0;
if (PyObject_SetAttr(state->stmt_type, state->end_lineno, Py_None) == -1)
return 0;
if (PyObject_SetAttr(state->stmt_type, state->end_col_offset, Py_None) ==
-1)
return 0;
- state->FunctionDef_type = make_type("FunctionDef", state->stmt_type,
+ state->FunctionDef_type = make_type(state, "FunctionDef", state->stmt_type,
FunctionDef_fields, 6,
"FunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment)");
if (!state->FunctionDef_type) return 0;
@@ -1480,7 +1498,7 @@ static int init_types(void)
if (PyObject_SetAttr(state->FunctionDef_type, state->type_comment, Py_None)
== -1)
return 0;
- state->AsyncFunctionDef_type = make_type("AsyncFunctionDef",
+ state->AsyncFunctionDef_type = make_type(state, "AsyncFunctionDef",
state->stmt_type,
AsyncFunctionDef_fields, 6,
"AsyncFunctionDef(identifier name, arguments args, stmt* body, expr* decorator_list, expr? returns, string? type_comment)");
@@ -1491,83 +1509,91 @@ static int init_types(void)
if (PyObject_SetAttr(state->AsyncFunctionDef_type, state->type_comment,
Py_None) == -1)
return 0;
- state->ClassDef_type = make_type("ClassDef", state->stmt_type,
+ state->ClassDef_type = make_type(state, "ClassDef", state->stmt_type,
ClassDef_fields, 5,
"ClassDef(identifier name, expr* bases, keyword* keywords, stmt* body, expr* decorator_list)");
if (!state->ClassDef_type) return 0;
- state->Return_type = make_type("Return", state->stmt_type, Return_fields, 1,
+ state->Return_type = make_type(state, "Return", state->stmt_type,
+ Return_fields, 1,
"Return(expr? value)");
if (!state->Return_type) return 0;
if (PyObject_SetAttr(state->Return_type, state->value, Py_None) == -1)
return 0;
- state->Delete_type = make_type("Delete", state->stmt_type, Delete_fields, 1,
+ state->Delete_type = make_type(state, "Delete", state->stmt_type,
+ Delete_fields, 1,
"Delete(expr* targets)");
if (!state->Delete_type) return 0;
- state->Assign_type = make_type("Assign", state->stmt_type, Assign_fields, 3,
+ state->Assign_type = make_type(state, "Assign", state->stmt_type,
+ Assign_fields, 3,
"Assign(expr* targets, expr value, string? type_comment)");
if (!state->Assign_type) return 0;
if (PyObject_SetAttr(state->Assign_type, state->type_comment, Py_None) ==
-1)
return 0;
- state->AugAssign_type = make_type("AugAssign", state->stmt_type,
+ state->AugAssign_type = make_type(state, "AugAssign", state->stmt_type,
AugAssign_fields, 3,
"AugAssign(expr target, operator op, expr value)");
if (!state->AugAssign_type) return 0;
- state->AnnAssign_type = make_type("AnnAssign", state->stmt_type,
+ state->AnnAssign_type = make_type(state, "AnnAssign", state->stmt_type,
AnnAssign_fields, 4,
"AnnAssign(expr target, expr annotation, expr? value, int simple)");
if (!state->AnnAssign_type) return 0;
if (PyObject_SetAttr(state->AnnAssign_type, state->value, Py_None) == -1)
return 0;
- state->For_type = make_type("For", state->stmt_type, For_fields, 5,
+ state->For_type = make_type(state, "For", state->stmt_type, For_fields, 5,
"For(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)");
if (!state->For_type) return 0;
if (PyObject_SetAttr(state->For_type, state->type_comment, Py_None) == -1)
return 0;
- state->AsyncFor_type = make_type("AsyncFor", state->stmt_type,
+ state->AsyncFor_type = make_type(state, "AsyncFor", state->stmt_type,
AsyncFor_fields, 5,
"AsyncFor(expr target, expr iter, stmt* body, stmt* orelse, string? type_comment)");
if (!state->AsyncFor_type) return 0;
if (PyObject_SetAttr(state->AsyncFor_type, state->type_comment, Py_None) ==
-1)
return 0;
- state->While_type = make_type("While", state->stmt_type, While_fields, 3,
+ state->While_type = make_type(state, "While", state->stmt_type,
+ While_fields, 3,
"While(expr test, stmt* body, stmt* orelse)");
if (!state->While_type) return 0;
- state->If_type = make_type("If", state->stmt_type, If_fields, 3,
+ state->If_type = make_type(state, "If", state->stmt_type, If_fields, 3,
"If(expr test, stmt* body, stmt* orelse)");
if (!state->If_type) return 0;
- state->With_type = make_type("With", state->stmt_type, With_fields, 3,
+ state->With_type = make_type(state, "With", state->stmt_type, With_fields,
+ 3,
"With(withitem* items, stmt* body, string? type_comment)");
if (!state->With_type) return 0;
if (PyObject_SetAttr(state->With_type, state->type_comment, Py_None) == -1)
return 0;
- state->AsyncWith_type = make_type("AsyncWith", state->stmt_type,
+ state->AsyncWith_type = make_type(state, "AsyncWith", state->stmt_type,
AsyncWith_fields, 3,
"AsyncWith(withitem* items, stmt* body, string? type_comment)");
if (!state->AsyncWith_type) return 0;
if (PyObject_SetAttr(state->AsyncWith_type, state->type_comment, Py_None)
== -1)
return 0;
- state->Raise_type = make_type("Raise", state->stmt_type, Raise_fields, 2,
+ state->Raise_type = make_type(state, "Raise", state->stmt_type,
+ Raise_fields, 2,
"Raise(expr? exc, expr? cause)");
if (!state->Raise_type) return 0;
if (PyObject_SetAttr(state->Raise_type, state->exc, Py_None) == -1)
return 0;
if (PyObject_SetAttr(state->Raise_type, state->cause, Py_None) == -1)
return 0;
- state->Try_type = make_type("Try", state->stmt_type, Try_fields, 4,
+ state->Try_type = make_type(state, "Try", state->stmt_type, Try_fields, 4,
"Try(stmt* body, excepthandler* handlers, stmt* orelse, stmt* finalbody)");
if (!state->Try_type) return 0;
- state->Assert_type = make_type("Assert", state->stmt_type, Assert_fields, 2,
+ state->Assert_type = make_type(state, "Assert", state->stmt_type,
+ Assert_fields, 2,
"Assert(expr test, expr? msg)");
if (!state->Assert_type) return 0;
if (PyObject_SetAttr(state->Assert_type, state->msg, Py_None) == -1)
return 0;
- state->Import_type = make_type("Import", state->stmt_type, Import_fields, 1,
+ state->Import_type = make_type(state, "Import", state->stmt_type,
+ Import_fields, 1,
"Import(alias* names)");
if (!state->Import_type) return 0;
- state->ImportFrom_type = make_type("ImportFrom", state->stmt_type,
+ state->ImportFrom_type = make_type(state, "ImportFrom", state->stmt_type,
ImportFrom_fields, 3,
"ImportFrom(identifier? module, alias* names, int? level)");
if (!state->ImportFrom_type) return 0;
@@ -1575,26 +1601,29 @@ static int init_types(void)
return 0;
if (PyObject_SetAttr(state->ImportFrom_type, state->level, Py_None) == -1)
return 0;
- state->Global_type = make_type("Global", state->stmt_type, Global_fields, 1,
+ state->Global_type = make_type(state, "Global", state->stmt_type,
+ Global_fields, 1,
"Global(identifier* names)");
if (!state->Global_type) return 0;
- state->Nonlocal_type = make_type("Nonlocal", state->stmt_type,
+ state->Nonlocal_type = make_type(state, "Nonlocal", state->stmt_type,
Nonlocal_fields, 1,
"Nonlocal(identifier* names)");
if (!state->Nonlocal_type) return 0;
- state->Expr_type = make_type("Expr", state->stmt_type, Expr_fields, 1,
+ state->Expr_type = make_type(state, "Expr", state->stmt_type, Expr_fields,
+ 1,
"Expr(expr value)");
if (!state->Expr_type) return 0;
- state->Pass_type = make_type("Pass", state->stmt_type, NULL, 0,
+ state->Pass_type = make_type(state, "Pass", state->stmt_type, NULL, 0,
"Pass");
if (!state->Pass_type) return 0;
- state->Break_type = make_type("Break", state->stmt_type, NULL, 0,
+ state->Break_type = make_type(state, "Break", state->stmt_type, NULL, 0,
"Break");
if (!state->Break_type) return 0;
- state->Continue_type = make_type("Continue", state->stmt_type, NULL, 0,
+ state->Continue_type = make_type(state, "Continue", state->stmt_type, NULL,
+ 0,
"Continue");
if (!state->Continue_type) return 0;
- state->expr_type = make_type("expr", state->AST_type, NULL, 0,
+ state->expr_type = make_type(state, "expr", state->AST_type, NULL, 0,
"expr = BoolOp(boolop op, expr* values)\n"
" | NamedExpr(expr target, expr value)\n"
" | BinOp(expr left, operator op, expr right)\n"
@@ -1623,74 +1652,84 @@ static int init_types(void)
" | Tuple(expr* elts, expr_context ctx)\n"
" | Slice(expr? lower, expr? upper, expr? step)");
if (!state->expr_type) return 0;
- if (!add_attributes(state->expr_type, expr_attributes, 4)) return 0;
+ if (!add_attributes(state, state->expr_type, expr_attributes, 4)) return 0;
if (PyObject_SetAttr(state->expr_type, state->end_lineno, Py_None) == -1)
return 0;
if (PyObject_SetAttr(state->expr_type, state->end_col_offset, Py_None) ==
-1)
return 0;
- state->BoolOp_type = make_type("BoolOp", state->expr_type, BoolOp_fields, 2,
+ state->BoolOp_type = make_type(state, "BoolOp", state->expr_type,
+ BoolOp_fields, 2,
"BoolOp(boolop op, expr* values)");
if (!state->BoolOp_type) return 0;
- state->NamedExpr_type = make_type("NamedExpr", state->expr_type,
+ state->NamedExpr_type = make_type(state, "NamedExpr", state->expr_type,
NamedExpr_fields, 2,
"NamedExpr(expr target, expr value)");
if (!state->NamedExpr_type) return 0;
- state->BinOp_type = make_type("BinOp", state->expr_type, BinOp_fields, 3,
+ state->BinOp_type = make_type(state, "BinOp", state->expr_type,
+ BinOp_fields, 3,
"BinOp(expr left, operator op, expr right)");
if (!state->BinOp_type) return 0;
- state->UnaryOp_type = make_type("UnaryOp", state->expr_type,
+ state->UnaryOp_type = make_type(state, "UnaryOp", state->expr_type,
UnaryOp_fields, 2,
"UnaryOp(unaryop op, expr operand)");
if (!state->UnaryOp_type) return 0;
- state->Lambda_type = make_type("Lambda", state->expr_type, Lambda_fields, 2,
+ state->Lambda_type = make_type(state, "Lambda", state->expr_type,
+ Lambda_fields, 2,
"Lambda(arguments args, expr body)");
if (!state->Lambda_type) return 0;
- state->IfExp_type = make_type("IfExp", state->expr_type, IfExp_fields, 3,
+ state->IfExp_type = make_type(state, "IfExp", state->expr_type,
+ IfExp_fields, 3,
"IfExp(expr test, expr body, expr orelse)");
if (!state->IfExp_type) return 0;
- state->Dict_type = make_type("Dict", state->expr_type, Dict_fields, 2,
+ state->Dict_type = make_type(state, "Dict", state->expr_type, Dict_fields,
+ 2,
"Dict(expr* keys, expr* values)");
if (!state->Dict_type) return 0;
- state->Set_type = make_type("Set", state->expr_type, Set_fields, 1,
+ state->Set_type = make_type(state, "Set", state->expr_type, Set_fields, 1,
"Set(expr* elts)");
if (!state->Set_type) return 0;
- state->ListComp_type = make_type("ListComp", state->expr_type,
+ state->ListComp_type = make_type(state, "ListComp", state->expr_type,
ListComp_fields, 2,
"ListComp(expr elt, comprehension* generators)");
if (!state->ListComp_type) return 0;
- state->SetComp_type = make_type("SetComp", state->expr_type,
+ state->SetComp_type = make_type(state, "SetComp", state->expr_type,
SetComp_fields, 2,
"SetComp(expr elt, comprehension* generators)");
if (!state->SetComp_type) return 0;
- state->DictComp_type = make_type("DictComp", state->expr_type,
+ state->DictComp_type = make_type(state, "DictComp", state->expr_type,
DictComp_fields, 3,
"DictComp(expr key, expr value, comprehension* generators)");
if (!state->DictComp_type) return 0;
- state->GeneratorExp_type = make_type("GeneratorExp", state->expr_type,
- GeneratorExp_fields, 2,
+ state->GeneratorExp_type = make_type(state, "GeneratorExp",
+ state->expr_type, GeneratorExp_fields,
+ 2,
"GeneratorExp(expr elt, comprehension* generators)");
if (!state->GeneratorExp_type) return 0;
- state->Await_type = make_type("Await", state->expr_type, Await_fields, 1,
+ state->Await_type = make_type(state, "Await", state->expr_type,
+ Await_fields, 1,
"Await(expr value)");
if (!state->Await_type) return 0;
- state->Yield_type = make_type("Yield", state->expr_type, Yield_fields, 1,
+ state->Yield_type = make_type(state, "Yield", state->expr_type,
+ Yield_fields, 1,
"Yield(expr? value)");
if (!state->Yield_type) return 0;
if (PyObject_SetAttr(state->Yield_type, state->value, Py_None) == -1)
return 0;
- state->YieldFrom_type = make_type("YieldFrom", state->expr_type,
+ state->YieldFrom_type = make_type(state, "YieldFrom", state->expr_type,
YieldFrom_fields, 1,
"YieldFrom(expr value)");
if (!state->YieldFrom_type) return 0;
- state->Compare_type = make_type("Compare", state->expr_type,
+ state->Compare_type = make_type(state, "Compare", state->expr_type,
Compare_fields, 3,
"Compare(expr left, cmpop* ops, expr* comparators)");
if (!state->Compare_type) return 0;
- state->Call_type = make_type("Call", state->expr_type, Call_fields, 3,
+ state->Call_type = make_type(state, "Call", state->expr_type, Call_fields,
+ 3,
"Call(expr func, expr* args, keyword* keywords)");
if (!state->Call_type) return 0;
- state->FormattedValue_type = make_type("FormattedValue", state->expr_type,
+ state->FormattedValue_type = make_type(state, "FormattedValue",
+ state->expr_type,
FormattedValue_fields, 3,
"FormattedValue(expr value, int? conversion, expr? format_spec)");
if (!state->FormattedValue_type) return 0;
@@ -1700,38 +1739,42 @@ static int init_types(void)
if (PyObject_SetAttr(state->FormattedValue_type, state->format_spec,
Py_None) == -1)
return 0;
- state->JoinedStr_type = make_type("JoinedStr", state->expr_type,
+ state->JoinedStr_type = make_type(state, "JoinedStr", state->expr_type,
JoinedStr_fields, 1,
"JoinedStr(expr* values)");
if (!state->JoinedStr_type) return 0;
- state->Constant_type = make_type("Constant", state->expr_type,
+ state->Constant_type = make_type(state, "Constant", state->expr_type,
Constant_fields, 2,
"Constant(constant value, string? kind)");
if (!state->Constant_type) return 0;
if (PyObject_SetAttr(state->Constant_type, state->kind, Py_None) == -1)
return 0;
- state->Attribute_type = make_type("Attribute", state->expr_type,
+ state->Attribute_type = make_type(state, "Attribute", state->expr_type,
Attribute_fields, 3,
"Attribute(expr value, identifier attr, expr_context ctx)");
if (!state->Attribute_type) return 0;
- state->Subscript_type = make_type("Subscript", state->expr_type,
+ state->Subscript_type = make_type(state, "Subscript", state->expr_type,
Subscript_fields, 3,
"Subscript(expr value, expr slice, expr_context ctx)");
if (!state->Subscript_type) return 0;
- state->Starred_type = make_type("Starred", state->expr_type,
+ state->Starred_type = make_type(state, "Starred", state->expr_type,
Starred_fields, 2,
"Starred(expr value, expr_context ctx)");
if (!state->Starred_type) return 0;
- state->Name_type = make_type("Name", state->expr_type, Name_fields, 2,
+ state->Name_type = make_type(state, "Name", state->expr_type, Name_fields,
+ 2,
"Name(identifier id, expr_context ctx)");
if (!state->Name_type) return 0;
- state->List_type = make_type("List", state->expr_type, List_fields, 2,
+ state->List_type = make_type(state, "List", state->expr_type, List_fields,
+ 2,
"List(expr* elts, expr_context ctx)");
if (!state->List_type) return 0;
- state->Tuple_type = make_type("Tuple", state->expr_type, Tuple_fields, 2,
+ state->Tuple_type = make_type(state, "Tuple", state->expr_type,
+ Tuple_fields, 2,
"Tuple(expr* elts, expr_context ctx)");
if (!state->Tuple_type) return 0;
- state->Slice_type = make_type("Slice", state->expr_type, Slice_fields, 3,
+ state->Slice_type = make_type(state, "Slice", state->expr_type,
+ Slice_fields, 3,
"Slice(expr? lower, expr? upper, expr? step)");
if (!state->Slice_type) return 0;
if (PyObject_SetAttr(state->Slice_type, state->lower, Py_None) == -1)
@@ -1740,244 +1783,255 @@ static int init_types(void)
return 0;
if (PyObject_SetAttr(state->Slice_type, state->step, Py_None) == -1)
return 0;
- state->expr_context_type = make_type("expr_context", state->AST_type, NULL,
- 0,
+ state->expr_context_type = make_type(state, "expr_context",
+ state->AST_type, NULL, 0,
"expr_context = Load | Store | Del");
if (!state->expr_context_type) return 0;
- if (!add_attributes(state->expr_context_type, NULL, 0)) return 0;
- state->Load_type = make_type("Load", state->expr_context_type, NULL, 0,
+ if (!add_attributes(state, state->expr_context_type, NULL, 0)) return 0;
+ state->Load_type = make_type(state, "Load", state->expr_context_type, NULL,
+ 0,
"Load");
if (!state->Load_type) return 0;
state->Load_singleton = PyType_GenericNew((PyTypeObject *)state->Load_type,
NULL, NULL);
if (!state->Load_singleton) return 0;
- state->Store_type = make_type("Store", state->expr_context_type, NULL, 0,
+ state->Store_type = make_type(state, "Store", state->expr_context_type,
+ NULL, 0,
"Store");
if (!state->Store_type) return 0;
state->Store_singleton = PyType_GenericNew((PyTypeObject
*)state->Store_type, NULL, NULL);
if (!state->Store_singleton) return 0;
- state->Del_type = make_type("Del", state->expr_context_type, NULL, 0,
+ state->Del_type = make_type(state, "Del", state->expr_context_type, NULL, 0,
"Del");
if (!state->Del_type) return 0;
state->Del_singleton = PyType_GenericNew((PyTypeObject *)state->Del_type,
NULL, NULL);
if (!state->Del_singleton) return 0;
- state->boolop_type = make_type("boolop", state->AST_type, NULL, 0,
+ state->boolop_type = make_type(state, "boolop", state->AST_type, NULL, 0,
"boolop = And | Or");
if (!state->boolop_type) return 0;
- if (!add_attributes(state->boolop_type, NULL, 0)) return 0;
- state->And_type = make_type("And", state->boolop_type, NULL, 0,
+ if (!add_attributes(state, state->boolop_type, NULL, 0)) return 0;
+ state->And_type = make_type(state, "And", state->boolop_type, NULL, 0,
"And");
if (!state->And_type) return 0;
state->And_singleton = PyType_GenericNew((PyTypeObject *)state->And_type,
NULL, NULL);
if (!state->And_singleton) return 0;
- state->Or_type = make_type("Or", state->boolop_type, NULL, 0,
+ state->Or_type = make_type(state, "Or", state->boolop_type, NULL, 0,
"Or");
if (!state->Or_type) return 0;
state->Or_singleton = PyType_GenericNew((PyTypeObject *)state->Or_type,
NULL, NULL);
if (!state->Or_singleton) return 0;
- state->operator_type = make_type("operator", state->AST_type, NULL, 0,
+ state->operator_type = make_type(state, "operator", state->AST_type, NULL,
+ 0,
"operator = Add | Sub | Mult | MatMult | Div | Mod | Pow | LShift | RShift | BitOr | BitXor | BitAnd | FloorDiv");
if (!state->operator_type) return 0;
- if (!add_attributes(state->operator_type, NULL, 0)) return 0;
- state->Add_type = make_type("Add", state->operator_type, NULL, 0,
+ if (!add_attributes(state, state->operator_type, NULL, 0)) return 0;
+ state->Add_type = make_type(state, "Add", state->operator_type, NULL, 0,
"Add");
if (!state->Add_type) return 0;
state->Add_singleton = PyType_GenericNew((PyTypeObject *)state->Add_type,
NULL, NULL);
if (!state->Add_singleton) return 0;
- state->Sub_type = make_type("Sub", state->operator_type, NULL, 0,
+ state->Sub_type = make_type(state, "Sub", state->operator_type, NULL, 0,
"Sub");
if (!state->Sub_type) return 0;
state->Sub_singleton = PyType_GenericNew((PyTypeObject *)state->Sub_type,
NULL, NULL);
if (!state->Sub_singleton) return 0;
- state->Mult_type = make_type("Mult", state->operator_type, NULL, 0,
+ state->Mult_type = make_type(state, "Mult", state->operator_type, NULL, 0,
"Mult");
if (!state->Mult_type) return 0;
state->Mult_singleton = PyType_GenericNew((PyTypeObject *)state->Mult_type,
NULL, NULL);
if (!state->Mult_singleton) return 0;
- state->MatMult_type = make_type("MatMult", state->operator_type, NULL, 0,
+ state->MatMult_type = make_type(state, "MatMult", state->operator_type,
+ NULL, 0,
"MatMult");
if (!state->MatMult_type) return 0;
state->MatMult_singleton = PyType_GenericNew((PyTypeObject
*)state->MatMult_type, NULL,
NULL);
if (!state->MatMult_singleton) return 0;
- state->Div_type = make_type("Div", state->operator_type, NULL, 0,
+ state->Div_type = make_type(state, "Div", state->operator_type, NULL, 0,
"Div");
if (!state->Div_type) return 0;
state->Div_singleton = PyType_GenericNew((PyTypeObject *)state->Div_type,
NULL, NULL);
if (!state->Div_singleton) return 0;
- state->Mod_type = make_type("Mod", state->operator_type, NULL, 0,
+ state->Mod_type = make_type(state, "Mod", state->operator_type, NULL, 0,
"Mod");
if (!state->Mod_type) return 0;
state->Mod_singleton = PyType_GenericNew((PyTypeObject *)state->Mod_type,
NULL, NULL);
if (!state->Mod_singleton) return 0;
- state->Pow_type = make_type("Pow", state->operator_type, NULL, 0,
+ state->Pow_type = make_type(state, "Pow", state->operator_type, NULL, 0,
"Pow");
if (!state->Pow_type) return 0;
state->Pow_singleton = PyType_GenericNew((PyTypeObject *)state->Pow_type,
NULL, NULL);
if (!state->Pow_singleton) return 0;
- state->LShift_type = make_type("LShift", state->operator_type, NULL, 0,
+ state->LShift_type = make_type(state, "LShift", state->operator_type, NULL,
+ 0,
"LShift");
if (!state->LShift_type) return 0;
state->LShift_singleton = PyType_GenericNew((PyTypeObject
*)state->LShift_type, NULL,
NULL);
if (!state->LShift_singleton) return 0;
- state->RShift_type = make_type("RShift", state->operator_type, NULL, 0,
+ state->RShift_type = make_type(state, "RShift", state->operator_type, NULL,
+ 0,
"RShift");
if (!state->RShift_type) return 0;
state->RShift_singleton = PyType_GenericNew((PyTypeObject
*)state->RShift_type, NULL,
NULL);
if (!state->RShift_singleton) return 0;
- state->BitOr_type = make_type("BitOr", state->operator_type, NULL, 0,
+ state->BitOr_type = make_type(state, "BitOr", state->operator_type, NULL, 0,
"BitOr");
if (!state->BitOr_type) return 0;
state->BitOr_singleton = PyType_GenericNew((PyTypeObject
*)state->BitOr_type, NULL, NULL);
if (!state->BitOr_singleton) return 0;
- state->BitXor_type = make_type("BitXor", state->operator_type, NULL, 0,
+ state->BitXor_type = make_type(state, "BitXor", state->operator_type, NULL,
+ 0,
"BitXor");
if (!state->BitXor_type) return 0;
state->BitXor_singleton = PyType_GenericNew((PyTypeObject
*)state->BitXor_type, NULL,
NULL);
if (!state->BitXor_singleton) return 0;
- state->BitAnd_type = make_type("BitAnd", state->operator_type, NULL, 0,
+ state->BitAnd_type = make_type(state, "BitAnd", state->operator_type, NULL,
+ 0,
"BitAnd");
if (!state->BitAnd_type) return 0;
state->BitAnd_singleton = PyType_GenericNew((PyTypeObject
*)state->BitAnd_type, NULL,
NULL);
if (!state->BitAnd_singleton) return 0;
- state->FloorDiv_type = make_type("FloorDiv", state->operator_type, NULL, 0,
+ state->FloorDiv_type = make_type(state, "FloorDiv", state->operator_type,
+ NULL, 0,
"FloorDiv");
if (!state->FloorDiv_type) return 0;
state->FloorDiv_singleton = PyType_GenericNew((PyTypeObject
*)state->FloorDiv_type, NULL,
NULL);
if (!state->FloorDiv_singleton) return 0;
- state->unaryop_type = make_type("unaryop", state->AST_type, NULL, 0,
+ state->unaryop_type = make_type(state, "unaryop", state->AST_type, NULL, 0,
"unaryop = Invert | Not | UAdd | USub");
if (!state->unaryop_type) return 0;
- if (!add_attributes(state->unaryop_type, NULL, 0)) return 0;
- state->Invert_type = make_type("Invert", state->unaryop_type, NULL, 0,
+ if (!add_attributes(state, state->unaryop_type, NULL, 0)) return 0;
+ state->Invert_type = make_type(state, "Invert", state->unaryop_type, NULL,
+ 0,
"Invert");
if (!state->Invert_type) return 0;
state->Invert_singleton = PyType_GenericNew((PyTypeObject
*)state->Invert_type, NULL,
NULL);
if (!state->Invert_singleton) return 0;
- state->Not_type = make_type("Not", state->unaryop_type, NULL, 0,
+ state->Not_type = make_type(state, "Not", state->unaryop_type, NULL, 0,
"Not");
if (!state->Not_type) return 0;
state->Not_singleton = PyType_GenericNew((PyTypeObject *)state->Not_type,
NULL, NULL);
if (!state->Not_singleton) return 0;
- state->UAdd_type = make_type("UAdd", state->unaryop_type, NULL, 0,
+ state->UAdd_type = make_type(state, "UAdd", state->unaryop_type, NULL, 0,
"UAdd");
if (!state->UAdd_type) return 0;
state->UAdd_singleton = PyType_GenericNew((PyTypeObject *)state->UAdd_type,
NULL, NULL);
if (!state->UAdd_singleton) return 0;
- state->USub_type = make_type("USub", state->unaryop_type, NULL, 0,
+ state->USub_type = make_type(state, "USub", state->unaryop_type, NULL, 0,
"USub");
if (!state->USub_type) return 0;
state->USub_singleton = PyType_GenericNew((PyTypeObject *)state->USub_type,
NULL, NULL);
if (!state->USub_singleton) return 0;
- state->cmpop_type = make_type("cmpop", state->AST_type, NULL, 0,
+ state->cmpop_type = make_type(state, "cmpop", state->AST_type, NULL, 0,
"cmpop = Eq | NotEq | Lt | LtE | Gt | GtE | Is | IsNot | In | NotIn");
if (!state->cmpop_type) return 0;
- if (!add_attributes(state->cmpop_type, NULL, 0)) return 0;
- state->Eq_type = make_type("Eq", state->cmpop_type, NULL, 0,
+ if (!add_attributes(state, state->cmpop_type, NULL, 0)) return 0;
+ state->Eq_type = make_type(state, "Eq", state->cmpop_type, NULL, 0,
"Eq");
if (!state->Eq_type) return 0;
state->Eq_singleton = PyType_GenericNew((PyTypeObject *)state->Eq_type,
NULL, NULL);
if (!state->Eq_singleton) return 0;
- state->NotEq_type = make_type("NotEq", state->cmpop_type, NULL, 0,
+ state->NotEq_type = make_type(state, "NotEq", state->cmpop_type, NULL, 0,
"NotEq");
if (!state->NotEq_type) return 0;
state->NotEq_singleton = PyType_GenericNew((PyTypeObject
*)state->NotEq_type, NULL, NULL);
if (!state->NotEq_singleton) return 0;
- state->Lt_type = make_type("Lt", state->cmpop_type, NULL, 0,
+ state->Lt_type = make_type(state, "Lt", state->cmpop_type, NULL, 0,
"Lt");
if (!state->Lt_type) return 0;
state->Lt_singleton = PyType_GenericNew((PyTypeObject *)state->Lt_type,
NULL, NULL);
if (!state->Lt_singleton) return 0;
- state->LtE_type = make_type("LtE", state->cmpop_type, NULL, 0,
+ state->LtE_type = make_type(state, "LtE", state->cmpop_type, NULL, 0,
"LtE");
if (!state->LtE_type) return 0;
state->LtE_singleton = PyType_GenericNew((PyTypeObject *)state->LtE_type,
NULL, NULL);
if (!state->LtE_singleton) return 0;
- state->Gt_type = make_type("Gt", state->cmpop_type, NULL, 0,
+ state->Gt_type = make_type(state, "Gt", state->cmpop_type, NULL, 0,
"Gt");
if (!state->Gt_type) return 0;
state->Gt_singleton = PyType_GenericNew((PyTypeObject *)state->Gt_type,
NULL, NULL);
if (!state->Gt_singleton) return 0;
- state->GtE_type = make_type("GtE", state->cmpop_type, NULL, 0,
+ state->GtE_type = make_type(state, "GtE", state->cmpop_type, NULL, 0,
"GtE");
if (!state->GtE_type) return 0;
state->GtE_singleton = PyType_GenericNew((PyTypeObject *)state->GtE_type,
NULL, NULL);
if (!state->GtE_singleton) return 0;
- state->Is_type = make_type("Is", state->cmpop_type, NULL, 0,
+ state->Is_type = make_type(state, "Is", state->cmpop_type, NULL, 0,
"Is");
if (!state->Is_type) return 0;
state->Is_singleton = PyType_GenericNew((PyTypeObject *)state->Is_type,
NULL, NULL);
if (!state->Is_singleton) return 0;
- state->IsNot_type = make_type("IsNot", state->cmpop_type, NULL, 0,
+ state->IsNot_type = make_type(state, "IsNot", state->cmpop_type, NULL, 0,
"IsNot");
if (!state->IsNot_type) return 0;
state->IsNot_singleton = PyType_GenericNew((PyTypeObject
*)state->IsNot_type, NULL, NULL);
if (!state->IsNot_singleton) return 0;
- state->In_type = make_type("In", state->cmpop_type, NULL, 0,
+ state->In_type = make_type(state, "In", state->cmpop_type, NULL, 0,
"In");
if (!state->In_type) return 0;
state->In_singleton = PyType_GenericNew((PyTypeObject *)state->In_type,
NULL, NULL);
if (!state->In_singleton) return 0;
- state->NotIn_type = make_type("NotIn", state->cmpop_type, NULL, 0,
+ state->NotIn_type = make_type(state, "NotIn", state->cmpop_type, NULL, 0,
"NotIn");
if (!state->NotIn_type) return 0;
state->NotIn_singleton = PyType_GenericNew((PyTypeObject
*)state->NotIn_type, NULL, NULL);
if (!state->NotIn_singleton) return 0;
- state->comprehension_type = make_type("comprehension", state->AST_type,
+ state->comprehension_type = make_type(state, "comprehension",
+ state->AST_type,
comprehension_fields, 4,
"comprehension(expr target, expr iter, expr* ifs, int is_async)");
if (!state->comprehension_type) return 0;
- if (!add_attributes(state->comprehension_type, NULL, 0)) return 0;
- state->excepthandler_type = make_type("excepthandler", state->AST_type,
- NULL, 0,
+ if (!add_attributes(state, state->comprehension_type, NULL, 0)) return 0;
+ state->excepthandler_type = make_type(state, "excepthandler",
+ state->AST_type, NULL, 0,
"excepthandler = ExceptHandler(expr? type, identifier? name, stmt* body)");
if (!state->excepthandler_type) return 0;
- if (!add_attributes(state->excepthandler_type, excepthandler_attributes,
- 4)) return 0;
+ if (!add_attributes(state, state->excepthandler_type,
+ excepthandler_attributes, 4)) return 0;
if (PyObject_SetAttr(state->excepthandler_type, state->end_lineno, Py_None)
== -1)
return 0;
if (PyObject_SetAttr(state->excepthandler_type, state->end_col_offset,
Py_None) == -1)
return 0;
- state->ExceptHandler_type = make_type("ExceptHandler",
+ state->ExceptHandler_type = make_type(state, "ExceptHandler",
state->excepthandler_type,
ExceptHandler_fields, 3,
"ExceptHandler(expr? type, identifier? name, stmt* body)");
@@ -1986,19 +2040,19 @@ static int init_types(void)
return 0;
if (PyObject_SetAttr(state->ExceptHandler_type, state->name, Py_None) == -1)
return 0;
- state->arguments_type = make_type("arguments", state->AST_type,
+ state->arguments_type = make_type(state, "arguments", state->AST_type,
arguments_fields, 7,
"arguments(arg* posonlyargs, arg* args, arg? vararg, arg* kwonlyargs, expr* kw_defaults, arg? kwarg, expr* defaults)");
if (!state->arguments_type) return 0;
- if (!add_attributes(state->arguments_type, NULL, 0)) return 0;
+ if (!add_attributes(state, state->arguments_type, NULL, 0)) return 0;
if (PyObject_SetAttr(state->arguments_type, state->vararg, Py_None) == -1)
return 0;
if (PyObject_SetAttr(state->arguments_type, state->kwarg, Py_None) == -1)
return 0;
- state->arg_type = make_type("arg", state->AST_type, arg_fields, 3,
+ state->arg_type = make_type(state, "arg", state->AST_type, arg_fields, 3,
"arg(identifier arg, expr? annotation, string? type_comment)");
if (!state->arg_type) return 0;
- if (!add_attributes(state->arg_type, arg_attributes, 4)) return 0;
+ if (!add_attributes(state, state->arg_type, arg_attributes, 4)) return 0;
if (PyObject_SetAttr(state->arg_type, state->annotation, Py_None) == -1)
return 0;
if (PyObject_SetAttr(state->arg_type, state->type_comment, Py_None) == -1)
@@ -2007,11 +2061,12 @@ static int init_types(void)
return 0;
if (PyObject_SetAttr(state->arg_type, state->end_col_offset, Py_None) == -1)
return 0;
- state->keyword_type = make_type("keyword", state->AST_type, keyword_fields,
- 2,
+ state->keyword_type = make_type(state, "keyword", state->AST_type,
+ keyword_fields, 2,
"keyword(identifier? arg, expr value)");
if (!state->keyword_type) return 0;
- if (!add_attributes(state->keyword_type, keyword_attributes, 4)) return 0;
+ if (!add_attributes(state, state->keyword_type, keyword_attributes, 4))
+ return 0;
if (PyObject_SetAttr(state->keyword_type, state->arg, Py_None) == -1)
return 0;
if (PyObject_SetAttr(state->keyword_type, state->end_lineno, Py_None) == -1)
@@ -2019,25 +2074,28 @@ static int init_types(void)
if (PyObject_SetAttr(state->keyword_type, state->end_col_offset, Py_None)
== -1)
return 0;
- state->alias_type = make_type("alias", state->AST_type, alias_fields, 2,
+ state->alias_type = make_type(state, "alias", state->AST_type,
+ alias_fields, 2,
"alias(identifier name, identifier? asname)");
if (!state->alias_type) return 0;
- if (!add_attributes(state->alias_type, NULL, 0)) return 0;
+ if (!add_attributes(state, state->alias_type, NULL, 0)) return 0;
if (PyObject_SetAttr(state->alias_type, state->asname, Py_None) == -1)
return 0;
- state->withitem_type = make_type("withitem", state->AST_type,
+ state->withitem_type = make_type(state, "withitem", state->AST_type,
withitem_fields, 2,
"withitem(expr context_expr, expr? optional_vars)");
if (!state->withitem_type) return 0;
- if (!add_attributes(state->withitem_type, NULL, 0)) return 0;
+ if (!add_attributes(state, state->withitem_type, NULL, 0)) return 0;
if (PyObject_SetAttr(state->withitem_type, state->optional_vars, Py_None)
== -1)
return 0;
- state->type_ignore_type = make_type("type_ignore", state->AST_type, NULL, 0,
+ state->type_ignore_type = make_type(state, "type_ignore", state->AST_type,
+ NULL, 0,
"type_ignore = TypeIgnore(int lineno, string tag)");
if (!state->type_ignore_type) return 0;
- if (!add_attributes(state->type_ignore_type, NULL, 0)) return 0;
- state->TypeIgnore_type = make_type("TypeIgnore", state->type_ignore_type,
+ if (!add_attributes(state, state->type_ignore_type, NULL, 0)) return 0;
+ state->TypeIgnore_type = make_type(state, "TypeIgnore",
+ state->type_ignore_type,
TypeIgnore_fields, 2,
"TypeIgnore(int lineno, string tag)");
if (!state->TypeIgnore_type) return 0;
@@ -2045,26 +2103,38 @@ static int init_types(void)
return 1;
}
-static int obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena);
-static int obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena);
-static int obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena);
-static int obj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena*
- arena);
-static int obj2ast_boolop(PyObject* obj, boolop_ty* out, PyArena* arena);
-static int obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena);
-static int obj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena);
-static int obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena);
-static int obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena*
- arena);
-static int obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena*
- arena);
-static int obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena);
-static int obj2ast_arg(PyObject* obj, arg_ty* out, PyArena* arena);
-static int obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena);
-static int obj2ast_alias(PyObject* obj, alias_ty* out, PyArena* arena);
-static int obj2ast_withitem(PyObject* obj, withitem_ty* out, PyArena* arena);
-static int obj2ast_type_ignore(PyObject* obj, type_ignore_ty* out, PyArena*
- arena);
+static int obj2ast_mod(astmodulestate *state, PyObject* obj, mod_ty* out,
+ PyArena* arena);
+static int obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out,
+ PyArena* arena);
+static int obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out,
+ PyArena* arena);
+static int obj2ast_expr_context(astmodulestate *state, PyObject* obj,
+ expr_context_ty* out, PyArena* arena);
+static int obj2ast_boolop(astmodulestate *state, PyObject* obj, boolop_ty* out,
+ PyArena* arena);
+static int obj2ast_operator(astmodulestate *state, PyObject* obj, operator_ty*
+ out, PyArena* arena);
+static int obj2ast_unaryop(astmodulestate *state, PyObject* obj, unaryop_ty*
+ out, PyArena* arena);
+static int obj2ast_cmpop(astmodulestate *state, PyObject* obj, cmpop_ty* out,
+ PyArena* arena);
+static int obj2ast_comprehension(astmodulestate *state, PyObject* obj,
+ comprehension_ty* out, PyArena* arena);
+static int obj2ast_excepthandler(astmodulestate *state, PyObject* obj,
+ excepthandler_ty* out, PyArena* arena);
+static int obj2ast_arguments(astmodulestate *state, PyObject* obj,
+ arguments_ty* out, PyArena* arena);
+static int obj2ast_arg(astmodulestate *state, PyObject* obj, arg_ty* out,
+ PyArena* arena);
+static int obj2ast_keyword(astmodulestate *state, PyObject* obj, keyword_ty*
+ out, PyArena* arena);
+static int obj2ast_alias(astmodulestate *state, PyObject* obj, alias_ty* out,
+ PyArena* arena);
+static int obj2ast_withitem(astmodulestate *state, PyObject* obj, withitem_ty*
+ out, PyArena* arena);
+static int obj2ast_type_ignore(astmodulestate *state, PyObject* obj,
+ type_ignore_ty* out, PyArena* arena);
mod_ty
Module(asdl_seq * body, asdl_seq * type_ignores, PyArena *arena)
@@ -3528,7 +3598,7 @@ TypeIgnore(int lineno, string tag, PyArena *arena)
PyObject*
-ast2obj_mod(void* _o)
+ast2obj_mod(astmodulestate *state, void* _o)
{
mod_ty o = (mod_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -3536,58 +3606,55 @@ ast2obj_mod(void* _o)
if (!o) {
Py_RETURN_NONE;
}
-
switch (o->kind) {
case Module_kind:
- tp = (PyTypeObject *)astmodulestate_global->Module_type;
+ tp = (PyTypeObject *)state->Module_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(o->v.Module.body, ast2obj_stmt);
+ value = ast2obj_list(state, o->v.Module.body, ast2obj_stmt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->body, value) == -1)
+ if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.Module.type_ignores, ast2obj_type_ignore);
+ value = ast2obj_list(state, o->v.Module.type_ignores,
+ ast2obj_type_ignore);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->type_ignores,
- value) == -1)
+ if (PyObject_SetAttr(result, state->type_ignores, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Interactive_kind:
- tp = (PyTypeObject *)astmodulestate_global->Interactive_type;
+ tp = (PyTypeObject *)state->Interactive_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(o->v.Interactive.body, ast2obj_stmt);
+ value = ast2obj_list(state, o->v.Interactive.body, ast2obj_stmt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->body, value) == -1)
+ if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Expression_kind:
- tp = (PyTypeObject *)astmodulestate_global->Expression_type;
+ tp = (PyTypeObject *)state->Expression_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.Expression.body);
+ value = ast2obj_expr(state, o->v.Expression.body);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->body, value) == -1)
+ if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
break;
case FunctionType_kind:
- tp = (PyTypeObject *)astmodulestate_global->FunctionType_type;
+ tp = (PyTypeObject *)state->FunctionType_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(o->v.FunctionType.argtypes, ast2obj_expr);
+ value = ast2obj_list(state, o->v.FunctionType.argtypes, ast2obj_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->argtypes, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->argtypes, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.FunctionType.returns);
+ value = ast2obj_expr(state, o->v.FunctionType.returns);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->returns, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->returns, value) == -1)
goto failed;
Py_DECREF(value);
break;
@@ -3600,7 +3667,7 @@ ast2obj_mod(void* _o)
}
PyObject*
-ast2obj_stmt(void* _o)
+ast2obj_stmt(astmodulestate *state, void* _o)
{
stmt_ty o = (stmt_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -3608,513 +3675,483 @@ ast2obj_stmt(void* _o)
if (!o) {
Py_RETURN_NONE;
}
-
switch (o->kind) {
case FunctionDef_kind:
- tp = (PyTypeObject *)astmodulestate_global->FunctionDef_type;
+ tp = (PyTypeObject *)state->FunctionDef_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_identifier(o->v.FunctionDef.name);
+ value = ast2obj_identifier(state, o->v.FunctionDef.name);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->name, value) == -1)
+ if (PyObject_SetAttr(result, state->name, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_arguments(o->v.FunctionDef.args);
+ value = ast2obj_arguments(state, o->v.FunctionDef.args);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->args, value) == -1)
+ if (PyObject_SetAttr(result, state->args, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.FunctionDef.body, ast2obj_stmt);
+ value = ast2obj_list(state, o->v.FunctionDef.body, ast2obj_stmt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->body, value) == -1)
+ if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.FunctionDef.decorator_list, ast2obj_expr);
+ value = ast2obj_list(state, o->v.FunctionDef.decorator_list,
+ ast2obj_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->decorator_list,
- value) == -1)
+ if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.FunctionDef.returns);
+ value = ast2obj_expr(state, o->v.FunctionDef.returns);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->returns, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->returns, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(o->v.FunctionDef.type_comment);
+ value = ast2obj_string(state, o->v.FunctionDef.type_comment);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->type_comment,
- value) == -1)
+ if (PyObject_SetAttr(result, state->type_comment, value) == -1)
goto failed;
Py_DECREF(value);
break;
case AsyncFunctionDef_kind:
- tp = (PyTypeObject *)astmodulestate_global->AsyncFunctionDef_type;
+ tp = (PyTypeObject *)state->AsyncFunctionDef_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_identifier(o->v.AsyncFunctionDef.name);
+ value = ast2obj_identifier(state, o->v.AsyncFunctionDef.name);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->name, value) == -1)
+ if (PyObject_SetAttr(result, state->name, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_arguments(o->v.AsyncFunctionDef.args);
+ value = ast2obj_arguments(state, o->v.AsyncFunctionDef.args);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->args, value) == -1)
+ if (PyObject_SetAttr(result, state->args, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.AsyncFunctionDef.body, ast2obj_stmt);
+ value = ast2obj_list(state, o->v.AsyncFunctionDef.body, ast2obj_stmt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->body, value) == -1)
+ if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.AsyncFunctionDef.decorator_list,
+ value = ast2obj_list(state, o->v.AsyncFunctionDef.decorator_list,
ast2obj_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->decorator_list,
- value) == -1)
+ if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.AsyncFunctionDef.returns);
+ value = ast2obj_expr(state, o->v.AsyncFunctionDef.returns);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->returns, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->returns, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(o->v.AsyncFunctionDef.type_comment);
+ value = ast2obj_string(state, o->v.AsyncFunctionDef.type_comment);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->type_comment,
- value) == -1)
+ if (PyObject_SetAttr(result, state->type_comment, value) == -1)
goto failed;
Py_DECREF(value);
break;
case ClassDef_kind:
- tp = (PyTypeObject *)astmodulestate_global->ClassDef_type;
+ tp = (PyTypeObject *)state->ClassDef_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_identifier(o->v.ClassDef.name);
+ value = ast2obj_identifier(state, o->v.ClassDef.name);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->name, value) == -1)
+ if (PyObject_SetAttr(result, state->name, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.ClassDef.bases, ast2obj_expr);
+ value = ast2obj_list(state, o->v.ClassDef.bases, ast2obj_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->bases, value) == -1)
+ if (PyObject_SetAttr(result, state->bases, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.ClassDef.keywords, ast2obj_keyword);
+ value = ast2obj_list(state, o->v.ClassDef.keywords, ast2obj_keyword);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->keywords, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->keywords, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.ClassDef.body, ast2obj_stmt);
+ value = ast2obj_list(state, o->v.ClassDef.body, ast2obj_stmt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->body, value) == -1)
+ if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.ClassDef.decorator_list, ast2obj_expr);
+ value = ast2obj_list(state, o->v.ClassDef.decorator_list, ast2obj_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->decorator_list,
- value) == -1)
+ if (PyObject_SetAttr(result, state->decorator_list, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Return_kind:
- tp = (PyTypeObject *)astmodulestate_global->Return_type;
+ tp = (PyTypeObject *)state->Return_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.Return.value);
+ value = ast2obj_expr(state, o->v.Return.value);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->value, value) == -1)
+ if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Delete_kind:
- tp = (PyTypeObject *)astmodulestate_global->Delete_type;
+ tp = (PyTypeObject *)state->Delete_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(o->v.Delete.targets, ast2obj_expr);
+ value = ast2obj_list(state, o->v.Delete.targets, ast2obj_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->targets, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->targets, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Assign_kind:
- tp = (PyTypeObject *)astmodulestate_global->Assign_type;
+ tp = (PyTypeObject *)state->Assign_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(o->v.Assign.targets, ast2obj_expr);
+ value = ast2obj_list(state, o->v.Assign.targets, ast2obj_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->targets, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->targets, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.Assign.value);
+ value = ast2obj_expr(state, o->v.Assign.value);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->value, value) == -1)
+ if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(o->v.Assign.type_comment);
+ value = ast2obj_string(state, o->v.Assign.type_comment);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->type_comment,
- value) == -1)
+ if (PyObject_SetAttr(result, state->type_comment, value) == -1)
goto failed;
Py_DECREF(value);
break;
case AugAssign_kind:
- tp = (PyTypeObject *)astmodulestate_global->AugAssign_type;
+ tp = (PyTypeObject *)state->AugAssign_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.AugAssign.target);
+ value = ast2obj_expr(state, o->v.AugAssign.target);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->target, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->target, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_operator(o->v.AugAssign.op);
+ value = ast2obj_operator(state, o->v.AugAssign.op);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->op, value) == -1)
+ if (PyObject_SetAttr(result, state->op, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.AugAssign.value);
+ value = ast2obj_expr(state, o->v.AugAssign.value);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->value, value) == -1)
+ if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
break;
case AnnAssign_kind:
- tp = (PyTypeObject *)astmodulestate_global->AnnAssign_type;
+ tp = (PyTypeObject *)state->AnnAssign_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.AnnAssign.target);
+ value = ast2obj_expr(state, o->v.AnnAssign.target);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->target, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->target, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.AnnAssign.annotation);
+ value = ast2obj_expr(state, o->v.AnnAssign.annotation);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->annotation, value)
- == -1)
+ if (PyObject_SetAttr(result, state->annotation, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.AnnAssign.value);
+ value = ast2obj_expr(state, o->v.AnnAssign.value);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->value, value) == -1)
+ if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->v.AnnAssign.simple);
+ value = ast2obj_int(state, o->v.AnnAssign.simple);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->simple, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->simple, value) == -1)
goto failed;
Py_DECREF(value);
break;
case For_kind:
- tp = (PyTypeObject *)astmodulestate_global->For_type;
+ tp = (PyTypeObject *)state->For_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.For.target);
+ value = ast2obj_expr(state, o->v.For.target);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->target, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->target, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.For.iter);
+ value = ast2obj_expr(state, o->v.For.iter);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->iter, value) == -1)
+ if (PyObject_SetAttr(result, state->iter, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.For.body, ast2obj_stmt);
+ value = ast2obj_list(state, o->v.For.body, ast2obj_stmt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->body, value) == -1)
+ if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.For.orelse, ast2obj_stmt);
+ value = ast2obj_list(state, o->v.For.orelse, ast2obj_stmt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->orelse, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->orelse, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(o->v.For.type_comment);
+ value = ast2obj_string(state, o->v.For.type_comment);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->type_comment,
- value) == -1)
+ if (PyObject_SetAttr(result, state->type_comment, value) == -1)
goto failed;
Py_DECREF(value);
break;
case AsyncFor_kind:
- tp = (PyTypeObject *)astmodulestate_global->AsyncFor_type;
+ tp = (PyTypeObject *)state->AsyncFor_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.AsyncFor.target);
+ value = ast2obj_expr(state, o->v.AsyncFor.target);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->target, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->target, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.AsyncFor.iter);
+ value = ast2obj_expr(state, o->v.AsyncFor.iter);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->iter, value) == -1)
+ if (PyObject_SetAttr(result, state->iter, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.AsyncFor.body, ast2obj_stmt);
+ value = ast2obj_list(state, o->v.AsyncFor.body, ast2obj_stmt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->body, value) == -1)
+ if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.AsyncFor.orelse, ast2obj_stmt);
+ value = ast2obj_list(state, o->v.AsyncFor.orelse, ast2obj_stmt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->orelse, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->orelse, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(o->v.AsyncFor.type_comment);
+ value = ast2obj_string(state, o->v.AsyncFor.type_comment);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->type_comment,
- value) == -1)
+ if (PyObject_SetAttr(result, state->type_comment, value) == -1)
goto failed;
Py_DECREF(value);
break;
case While_kind:
- tp = (PyTypeObject *)astmodulestate_global->While_type;
+ tp = (PyTypeObject *)state->While_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.While.test);
+ value = ast2obj_expr(state, o->v.While.test);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->test, value) == -1)
+ if (PyObject_SetAttr(result, state->test, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.While.body, ast2obj_stmt);
+ value = ast2obj_list(state, o->v.While.body, ast2obj_stmt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->body, value) == -1)
+ if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.While.orelse, ast2obj_stmt);
+ value = ast2obj_list(state, o->v.While.orelse, ast2obj_stmt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->orelse, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->orelse, value) == -1)
goto failed;
Py_DECREF(value);
break;
case If_kind:
- tp = (PyTypeObject *)astmodulestate_global->If_type;
+ tp = (PyTypeObject *)state->If_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.If.test);
+ value = ast2obj_expr(state, o->v.If.test);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->test, value) == -1)
+ if (PyObject_SetAttr(result, state->test, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.If.body, ast2obj_stmt);
+ value = ast2obj_list(state, o->v.If.body, ast2obj_stmt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->body, value) == -1)
+ if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.If.orelse, ast2obj_stmt);
+ value = ast2obj_list(state, o->v.If.orelse, ast2obj_stmt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->orelse, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->orelse, value) == -1)
goto failed;
Py_DECREF(value);
break;
case With_kind:
- tp = (PyTypeObject *)astmodulestate_global->With_type;
+ tp = (PyTypeObject *)state->With_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(o->v.With.items, ast2obj_withitem);
+ value = ast2obj_list(state, o->v.With.items, ast2obj_withitem);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->items, value) == -1)
+ if (PyObject_SetAttr(result, state->items, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.With.body, ast2obj_stmt);
+ value = ast2obj_list(state, o->v.With.body, ast2obj_stmt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->body, value) == -1)
+ if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(o->v.With.type_comment);
+ value = ast2obj_string(state, o->v.With.type_comment);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->type_comment,
- value) == -1)
+ if (PyObject_SetAttr(result, state->type_comment, value) == -1)
goto failed;
Py_DECREF(value);
break;
case AsyncWith_kind:
- tp = (PyTypeObject *)astmodulestate_global->AsyncWith_type;
+ tp = (PyTypeObject *)state->AsyncWith_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(o->v.AsyncWith.items, ast2obj_withitem);
+ value = ast2obj_list(state, o->v.AsyncWith.items, ast2obj_withitem);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->items, value) == -1)
+ if (PyObject_SetAttr(result, state->items, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.AsyncWith.body, ast2obj_stmt);
+ value = ast2obj_list(state, o->v.AsyncWith.body, ast2obj_stmt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->body, value) == -1)
+ if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(o->v.AsyncWith.type_comment);
+ value = ast2obj_string(state, o->v.AsyncWith.type_comment);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->type_comment,
- value) == -1)
+ if (PyObject_SetAttr(result, state->type_comment, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Raise_kind:
- tp = (PyTypeObject *)astmodulestate_global->Raise_type;
+ tp = (PyTypeObject *)state->Raise_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.Raise.exc);
+ value = ast2obj_expr(state, o->v.Raise.exc);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->exc, value) == -1)
+ if (PyObject_SetAttr(result, state->exc, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.Raise.cause);
+ value = ast2obj_expr(state, o->v.Raise.cause);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->cause, value) == -1)
+ if (PyObject_SetAttr(result, state->cause, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Try_kind:
- tp = (PyTypeObject *)astmodulestate_global->Try_type;
+ tp = (PyTypeObject *)state->Try_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(o->v.Try.body, ast2obj_stmt);
+ value = ast2obj_list(state, o->v.Try.body, ast2obj_stmt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->body, value) == -1)
+ if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.Try.handlers, ast2obj_excepthandler);
+ value = ast2obj_list(state, o->v.Try.handlers, ast2obj_excepthandler);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->handlers, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->handlers, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.Try.orelse, ast2obj_stmt);
+ value = ast2obj_list(state, o->v.Try.orelse, ast2obj_stmt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->orelse, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->orelse, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.Try.finalbody, ast2obj_stmt);
+ value = ast2obj_list(state, o->v.Try.finalbody, ast2obj_stmt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->finalbody, value)
- == -1)
+ if (PyObject_SetAttr(result, state->finalbody, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Assert_kind:
- tp = (PyTypeObject *)astmodulestate_global->Assert_type;
+ tp = (PyTypeObject *)state->Assert_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.Assert.test);
+ value = ast2obj_expr(state, o->v.Assert.test);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->test, value) == -1)
+ if (PyObject_SetAttr(result, state->test, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.Assert.msg);
+ value = ast2obj_expr(state, o->v.Assert.msg);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->msg, value) == -1)
+ if (PyObject_SetAttr(result, state->msg, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Import_kind:
- tp = (PyTypeObject *)astmodulestate_global->Import_type;
+ tp = (PyTypeObject *)state->Import_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(o->v.Import.names, ast2obj_alias);
+ value = ast2obj_list(state, o->v.Import.names, ast2obj_alias);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->names, value) == -1)
+ if (PyObject_SetAttr(result, state->names, value) == -1)
goto failed;
Py_DECREF(value);
break;
case ImportFrom_kind:
- tp = (PyTypeObject *)astmodulestate_global->ImportFrom_type;
+ tp = (PyTypeObject *)state->ImportFrom_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_identifier(o->v.ImportFrom.module);
+ value = ast2obj_identifier(state, o->v.ImportFrom.module);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->module, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->module, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.ImportFrom.names, ast2obj_alias);
+ value = ast2obj_list(state, o->v.ImportFrom.names, ast2obj_alias);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->names, value) == -1)
+ if (PyObject_SetAttr(result, state->names, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->v.ImportFrom.level);
+ value = ast2obj_int(state, o->v.ImportFrom.level);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->level, value) == -1)
+ if (PyObject_SetAttr(result, state->level, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Global_kind:
- tp = (PyTypeObject *)astmodulestate_global->Global_type;
+ tp = (PyTypeObject *)state->Global_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(o->v.Global.names, ast2obj_identifier);
+ value = ast2obj_list(state, o->v.Global.names, ast2obj_identifier);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->names, value) == -1)
+ if (PyObject_SetAttr(result, state->names, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Nonlocal_kind:
- tp = (PyTypeObject *)astmodulestate_global->Nonlocal_type;
+ tp = (PyTypeObject *)state->Nonlocal_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(o->v.Nonlocal.names, ast2obj_identifier);
+ value = ast2obj_list(state, o->v.Nonlocal.names, ast2obj_identifier);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->names, value) == -1)
+ if (PyObject_SetAttr(result, state->names, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Expr_kind:
- tp = (PyTypeObject *)astmodulestate_global->Expr_type;
+ tp = (PyTypeObject *)state->Expr_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.Expr.value);
+ value = ast2obj_expr(state, o->v.Expr.value);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->value, value) == -1)
+ if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Pass_kind:
- tp = (PyTypeObject *)astmodulestate_global->Pass_type;
+ tp = (PyTypeObject *)state->Pass_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
break;
case Break_kind:
- tp = (PyTypeObject *)astmodulestate_global->Break_type;
+ tp = (PyTypeObject *)state->Break_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
break;
case Continue_kind:
- tp = (PyTypeObject *)astmodulestate_global->Continue_type;
+ tp = (PyTypeObject *)state->Continue_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
break;
}
- value = ast2obj_int(o->lineno);
+ value = ast2obj_int(state, o->lineno);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->lineno, value) < 0)
+ if (PyObject_SetAttr(result, state->lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->col_offset);
+ value = ast2obj_int(state, o->col_offset);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->col_offset, value) < 0)
+ if (PyObject_SetAttr(result, state->col_offset, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->end_lineno);
+ value = ast2obj_int(state, o->end_lineno);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->end_lineno, value) < 0)
+ if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->end_col_offset);
+ value = ast2obj_int(state, o->end_col_offset);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->end_col_offset, value)
- < 0)
+ if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
goto failed;
Py_DECREF(value);
return result;
@@ -4125,7 +4162,7 @@ ast2obj_stmt(void* _o)
}
PyObject*
-ast2obj_expr(void* _o)
+ast2obj_expr(astmodulestate *state, void* _o)
{
expr_ty o = (expr_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -4133,245 +4170,238 @@ ast2obj_expr(void* _o)
if (!o) {
Py_RETURN_NONE;
}
-
switch (o->kind) {
case BoolOp_kind:
- tp = (PyTypeObject *)astmodulestate_global->BoolOp_type;
+ tp = (PyTypeObject *)state->BoolOp_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_boolop(o->v.BoolOp.op);
+ value = ast2obj_boolop(state, o->v.BoolOp.op);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->op, value) == -1)
+ if (PyObject_SetAttr(result, state->op, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.BoolOp.values, ast2obj_expr);
+ value = ast2obj_list(state, o->v.BoolOp.values, ast2obj_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->values, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->values, value) == -1)
goto failed;
Py_DECREF(value);
break;
case NamedExpr_kind:
- tp = (PyTypeObject *)astmodulestate_global->NamedExpr_type;
+ tp = (PyTypeObject *)state->NamedExpr_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.NamedExpr.target);
+ value = ast2obj_expr(state, o->v.NamedExpr.target);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->target, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->target, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.NamedExpr.value);
+ value = ast2obj_expr(state, o->v.NamedExpr.value);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->value, value) == -1)
+ if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
break;
case BinOp_kind:
- tp = (PyTypeObject *)astmodulestate_global->BinOp_type;
+ tp = (PyTypeObject *)state->BinOp_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.BinOp.left);
+ value = ast2obj_expr(state, o->v.BinOp.left);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->left, value) == -1)
+ if (PyObject_SetAttr(result, state->left, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_operator(o->v.BinOp.op);
+ value = ast2obj_operator(state, o->v.BinOp.op);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->op, value) == -1)
+ if (PyObject_SetAttr(result, state->op, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.BinOp.right);
+ value = ast2obj_expr(state, o->v.BinOp.right);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->right, value) == -1)
+ if (PyObject_SetAttr(result, state->right, value) == -1)
goto failed;
Py_DECREF(value);
break;
case UnaryOp_kind:
- tp = (PyTypeObject *)astmodulestate_global->UnaryOp_type;
+ tp = (PyTypeObject *)state->UnaryOp_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_unaryop(o->v.UnaryOp.op);
+ value = ast2obj_unaryop(state, o->v.UnaryOp.op);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->op, value) == -1)
+ if (PyObject_SetAttr(result, state->op, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.UnaryOp.operand);
+ value = ast2obj_expr(state, o->v.UnaryOp.operand);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->operand, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->operand, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Lambda_kind:
- tp = (PyTypeObject *)astmodulestate_global->Lambda_type;
+ tp = (PyTypeObject *)state->Lambda_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_arguments(o->v.Lambda.args);
+ value = ast2obj_arguments(state, o->v.Lambda.args);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->args, value) == -1)
+ if (PyObject_SetAttr(result, state->args, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.Lambda.body);
+ value = ast2obj_expr(state, o->v.Lambda.body);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->body, value) == -1)
+ if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
break;
case IfExp_kind:
- tp = (PyTypeObject *)astmodulestate_global->IfExp_type;
+ tp = (PyTypeObject *)state->IfExp_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.IfExp.test);
+ value = ast2obj_expr(state, o->v.IfExp.test);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->test, value) == -1)
+ if (PyObject_SetAttr(result, state->test, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.IfExp.body);
+ value = ast2obj_expr(state, o->v.IfExp.body);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->body, value) == -1)
+ if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.IfExp.orelse);
+ value = ast2obj_expr(state, o->v.IfExp.orelse);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->orelse, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->orelse, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Dict_kind:
- tp = (PyTypeObject *)astmodulestate_global->Dict_type;
+ tp = (PyTypeObject *)state->Dict_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(o->v.Dict.keys, ast2obj_expr);
+ value = ast2obj_list(state, o->v.Dict.keys, ast2obj_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->keys, value) == -1)
+ if (PyObject_SetAttr(result, state->keys, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.Dict.values, ast2obj_expr);
+ value = ast2obj_list(state, o->v.Dict.values, ast2obj_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->values, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->values, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Set_kind:
- tp = (PyTypeObject *)astmodulestate_global->Set_type;
+ tp = (PyTypeObject *)state->Set_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(o->v.Set.elts, ast2obj_expr);
+ value = ast2obj_list(state, o->v.Set.elts, ast2obj_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->elts, value) == -1)
+ if (PyObject_SetAttr(result, state->elts, value) == -1)
goto failed;
Py_DECREF(value);
break;
case ListComp_kind:
- tp = (PyTypeObject *)astmodulestate_global->ListComp_type;
+ tp = (PyTypeObject *)state->ListComp_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.ListComp.elt);
+ value = ast2obj_expr(state, o->v.ListComp.elt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->elt, value) == -1)
+ if (PyObject_SetAttr(result, state->elt, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.ListComp.generators, ast2obj_comprehension);
+ value = ast2obj_list(state, o->v.ListComp.generators,
+ ast2obj_comprehension);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->generators, value)
- == -1)
+ if (PyObject_SetAttr(result, state->generators, value) == -1)
goto failed;
Py_DECREF(value);
break;
case SetComp_kind:
- tp = (PyTypeObject *)astmodulestate_global->SetComp_type;
+ tp = (PyTypeObject *)state->SetComp_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.SetComp.elt);
+ value = ast2obj_expr(state, o->v.SetComp.elt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->elt, value) == -1)
+ if (PyObject_SetAttr(result, state->elt, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.SetComp.generators, ast2obj_comprehension);
+ value = ast2obj_list(state, o->v.SetComp.generators,
+ ast2obj_comprehension);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->generators, value)
- == -1)
+ if (PyObject_SetAttr(result, state->generators, value) == -1)
goto failed;
Py_DECREF(value);
break;
case DictComp_kind:
- tp = (PyTypeObject *)astmodulestate_global->DictComp_type;
+ tp = (PyTypeObject *)state->DictComp_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.DictComp.key);
+ value = ast2obj_expr(state, o->v.DictComp.key);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->key, value) == -1)
+ if (PyObject_SetAttr(result, state->key, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.DictComp.value);
+ value = ast2obj_expr(state, o->v.DictComp.value);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->value, value) == -1)
+ if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.DictComp.generators, ast2obj_comprehension);
+ value = ast2obj_list(state, o->v.DictComp.generators,
+ ast2obj_comprehension);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->generators, value)
- == -1)
+ if (PyObject_SetAttr(result, state->generators, value) == -1)
goto failed;
Py_DECREF(value);
break;
case GeneratorExp_kind:
- tp = (PyTypeObject *)astmodulestate_global->GeneratorExp_type;
+ tp = (PyTypeObject *)state->GeneratorExp_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.GeneratorExp.elt);
+ value = ast2obj_expr(state, o->v.GeneratorExp.elt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->elt, value) == -1)
+ if (PyObject_SetAttr(result, state->elt, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.GeneratorExp.generators,
+ value = ast2obj_list(state, o->v.GeneratorExp.generators,
ast2obj_comprehension);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->generators, value)
- == -1)
+ if (PyObject_SetAttr(result, state->generators, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Await_kind:
- tp = (PyTypeObject *)astmodulestate_global->Await_type;
+ tp = (PyTypeObject *)state->Await_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.Await.value);
+ value = ast2obj_expr(state, o->v.Await.value);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->value, value) == -1)
+ if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Yield_kind:
- tp = (PyTypeObject *)astmodulestate_global->Yield_type;
+ tp = (PyTypeObject *)state->Yield_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.Yield.value);
+ value = ast2obj_expr(state, o->v.Yield.value);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->value, value) == -1)
+ if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
break;
case YieldFrom_kind:
- tp = (PyTypeObject *)astmodulestate_global->YieldFrom_type;
+ tp = (PyTypeObject *)state->YieldFrom_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.YieldFrom.value);
+ value = ast2obj_expr(state, o->v.YieldFrom.value);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->value, value) == -1)
+ if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Compare_kind:
- tp = (PyTypeObject *)astmodulestate_global->Compare_type;
+ tp = (PyTypeObject *)state->Compare_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.Compare.left);
+ value = ast2obj_expr(state, o->v.Compare.left);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->left, value) == -1)
+ if (PyObject_SetAttr(result, state->left, value) == -1)
goto failed;
Py_DECREF(value);
{
@@ -4379,228 +4409,222 @@ ast2obj_expr(void* _o)
value = PyList_New(n);
if (!value) goto failed;
for(i = 0; i < n; i++)
- PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i)));
+ PyList_SET_ITEM(value, i, ast2obj_cmpop(state, (cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i)));
}
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->ops, value) == -1)
+ if (PyObject_SetAttr(result, state->ops, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.Compare.comparators, ast2obj_expr);
+ value = ast2obj_list(state, o->v.Compare.comparators, ast2obj_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->comparators, value)
- == -1)
+ if (PyObject_SetAttr(result, state->comparators, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Call_kind:
- tp = (PyTypeObject *)astmodulestate_global->Call_type;
+ tp = (PyTypeObject *)state->Call_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.Call.func);
+ value = ast2obj_expr(state, o->v.Call.func);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->func, value) == -1)
+ if (PyObject_SetAttr(result, state->func, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.Call.args, ast2obj_expr);
+ value = ast2obj_list(state, o->v.Call.args, ast2obj_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->args, value) == -1)
+ if (PyObject_SetAttr(result, state->args, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.Call.keywords, ast2obj_keyword);
+ value = ast2obj_list(state, o->v.Call.keywords, ast2obj_keyword);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->keywords, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->keywords, value) == -1)
goto failed;
Py_DECREF(value);
break;
case FormattedValue_kind:
- tp = (PyTypeObject *)astmodulestate_global->FormattedValue_type;
+ tp = (PyTypeObject *)state->FormattedValue_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.FormattedValue.value);
+ value = ast2obj_expr(state, o->v.FormattedValue.value);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->value, value) == -1)
+ if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->v.FormattedValue.conversion);
+ value = ast2obj_int(state, o->v.FormattedValue.conversion);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->conversion, value)
- == -1)
+ if (PyObject_SetAttr(result, state->conversion, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.FormattedValue.format_spec);
+ value = ast2obj_expr(state, o->v.FormattedValue.format_spec);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->format_spec, value)
- == -1)
+ if (PyObject_SetAttr(result, state->format_spec, value) == -1)
goto failed;
Py_DECREF(value);
break;
case JoinedStr_kind:
- tp = (PyTypeObject *)astmodulestate_global->JoinedStr_type;
+ tp = (PyTypeObject *)state->JoinedStr_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(o->v.JoinedStr.values, ast2obj_expr);
+ value = ast2obj_list(state, o->v.JoinedStr.values, ast2obj_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->values, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->values, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Constant_kind:
- tp = (PyTypeObject *)astmodulestate_global->Constant_type;
+ tp = (PyTypeObject *)state->Constant_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_constant(o->v.Constant.value);
+ value = ast2obj_constant(state, o->v.Constant.value);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->value, value) == -1)
+ if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(o->v.Constant.kind);
+ value = ast2obj_string(state, o->v.Constant.kind);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->kind, value) == -1)
+ if (PyObject_SetAttr(result, state->kind, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Attribute_kind:
- tp = (PyTypeObject *)astmodulestate_global->Attribute_type;
+ tp = (PyTypeObject *)state->Attribute_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.Attribute.value);
+ value = ast2obj_expr(state, o->v.Attribute.value);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->value, value) == -1)
+ if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_identifier(o->v.Attribute.attr);
+ value = ast2obj_identifier(state, o->v.Attribute.attr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->attr, value) == -1)
+ if (PyObject_SetAttr(result, state->attr, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr_context(o->v.Attribute.ctx);
+ value = ast2obj_expr_context(state, o->v.Attribute.ctx);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->ctx, value) == -1)
+ if (PyObject_SetAttr(result, state->ctx, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Subscript_kind:
- tp = (PyTypeObject *)astmodulestate_global->Subscript_type;
+ tp = (PyTypeObject *)state->Subscript_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.Subscript.value);
+ value = ast2obj_expr(state, o->v.Subscript.value);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->value, value) == -1)
+ if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.Subscript.slice);
+ value = ast2obj_expr(state, o->v.Subscript.slice);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->slice, value) == -1)
+ if (PyObject_SetAttr(result, state->slice, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr_context(o->v.Subscript.ctx);
+ value = ast2obj_expr_context(state, o->v.Subscript.ctx);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->ctx, value) == -1)
+ if (PyObject_SetAttr(result, state->ctx, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Starred_kind:
- tp = (PyTypeObject *)astmodulestate_global->Starred_type;
+ tp = (PyTypeObject *)state->Starred_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.Starred.value);
+ value = ast2obj_expr(state, o->v.Starred.value);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->value, value) == -1)
+ if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr_context(o->v.Starred.ctx);
+ value = ast2obj_expr_context(state, o->v.Starred.ctx);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->ctx, value) == -1)
+ if (PyObject_SetAttr(result, state->ctx, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Name_kind:
- tp = (PyTypeObject *)astmodulestate_global->Name_type;
+ tp = (PyTypeObject *)state->Name_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_identifier(o->v.Name.id);
+ value = ast2obj_identifier(state, o->v.Name.id);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->id, value) == -1)
+ if (PyObject_SetAttr(result, state->id, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr_context(o->v.Name.ctx);
+ value = ast2obj_expr_context(state, o->v.Name.ctx);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->ctx, value) == -1)
+ if (PyObject_SetAttr(result, state->ctx, value) == -1)
goto failed;
Py_DECREF(value);
break;
case List_kind:
- tp = (PyTypeObject *)astmodulestate_global->List_type;
+ tp = (PyTypeObject *)state->List_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(o->v.List.elts, ast2obj_expr);
+ value = ast2obj_list(state, o->v.List.elts, ast2obj_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->elts, value) == -1)
+ if (PyObject_SetAttr(result, state->elts, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr_context(o->v.List.ctx);
+ value = ast2obj_expr_context(state, o->v.List.ctx);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->ctx, value) == -1)
+ if (PyObject_SetAttr(result, state->ctx, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Tuple_kind:
- tp = (PyTypeObject *)astmodulestate_global->Tuple_type;
+ tp = (PyTypeObject *)state->Tuple_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_list(o->v.Tuple.elts, ast2obj_expr);
+ value = ast2obj_list(state, o->v.Tuple.elts, ast2obj_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->elts, value) == -1)
+ if (PyObject_SetAttr(result, state->elts, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr_context(o->v.Tuple.ctx);
+ value = ast2obj_expr_context(state, o->v.Tuple.ctx);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->ctx, value) == -1)
+ if (PyObject_SetAttr(result, state->ctx, value) == -1)
goto failed;
Py_DECREF(value);
break;
case Slice_kind:
- tp = (PyTypeObject *)astmodulestate_global->Slice_type;
+ tp = (PyTypeObject *)state->Slice_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.Slice.lower);
+ value = ast2obj_expr(state, o->v.Slice.lower);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->lower, value) == -1)
+ if (PyObject_SetAttr(result, state->lower, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.Slice.upper);
+ value = ast2obj_expr(state, o->v.Slice.upper);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->upper, value) == -1)
+ if (PyObject_SetAttr(result, state->upper, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->v.Slice.step);
+ value = ast2obj_expr(state, o->v.Slice.step);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->step, value) == -1)
+ if (PyObject_SetAttr(result, state->step, value) == -1)
goto failed;
Py_DECREF(value);
break;
}
- value = ast2obj_int(o->lineno);
+ value = ast2obj_int(state, o->lineno);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->lineno, value) < 0)
+ if (PyObject_SetAttr(result, state->lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->col_offset);
+ value = ast2obj_int(state, o->col_offset);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->col_offset, value) < 0)
+ if (PyObject_SetAttr(result, state->col_offset, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->end_lineno);
+ value = ast2obj_int(state, o->end_lineno);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->end_lineno, value) < 0)
+ if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->end_col_offset);
+ value = ast2obj_int(state, o->end_col_offset);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->end_col_offset, value)
- < 0)
+ if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
goto failed;
Py_DECREF(value);
return result;
@@ -4610,134 +4634,134 @@ ast2obj_expr(void* _o)
return NULL;
}
-PyObject* ast2obj_expr_context(expr_context_ty o)
+PyObject* ast2obj_expr_context(astmodulestate *state, expr_context_ty o)
{
switch(o) {
case Load:
- Py_INCREF(astmodulestate_global->Load_singleton);
- return astmodulestate_global->Load_singleton;
+ Py_INCREF(state->Load_singleton);
+ return state->Load_singleton;
case Store:
- Py_INCREF(astmodulestate_global->Store_singleton);
- return astmodulestate_global->Store_singleton;
+ Py_INCREF(state->Store_singleton);
+ return state->Store_singleton;
case Del:
- Py_INCREF(astmodulestate_global->Del_singleton);
- return astmodulestate_global->Del_singleton;
+ Py_INCREF(state->Del_singleton);
+ return state->Del_singleton;
}
Py_UNREACHABLE();
}
-PyObject* ast2obj_boolop(boolop_ty o)
+PyObject* ast2obj_boolop(astmodulestate *state, boolop_ty o)
{
switch(o) {
case And:
- Py_INCREF(astmodulestate_global->And_singleton);
- return astmodulestate_global->And_singleton;
+ Py_INCREF(state->And_singleton);
+ return state->And_singleton;
case Or:
- Py_INCREF(astmodulestate_global->Or_singleton);
- return astmodulestate_global->Or_singleton;
+ Py_INCREF(state->Or_singleton);
+ return state->Or_singleton;
}
Py_UNREACHABLE();
}
-PyObject* ast2obj_operator(operator_ty o)
+PyObject* ast2obj_operator(astmodulestate *state, operator_ty o)
{
switch(o) {
case Add:
- Py_INCREF(astmodulestate_global->Add_singleton);
- return astmodulestate_global->Add_singleton;
+ Py_INCREF(state->Add_singleton);
+ return state->Add_singleton;
case Sub:
- Py_INCREF(astmodulestate_global->Sub_singleton);
- return astmodulestate_global->Sub_singleton;
+ Py_INCREF(state->Sub_singleton);
+ return state->Sub_singleton;
case Mult:
- Py_INCREF(astmodulestate_global->Mult_singleton);
- return astmodulestate_global->Mult_singleton;
+ Py_INCREF(state->Mult_singleton);
+ return state->Mult_singleton;
case MatMult:
- Py_INCREF(astmodulestate_global->MatMult_singleton);
- return astmodulestate_global->MatMult_singleton;
+ Py_INCREF(state->MatMult_singleton);
+ return state->MatMult_singleton;
case Div:
- Py_INCREF(astmodulestate_global->Div_singleton);
- return astmodulestate_global->Div_singleton;
+ Py_INCREF(state->Div_singleton);
+ return state->Div_singleton;
case Mod:
- Py_INCREF(astmodulestate_global->Mod_singleton);
- return astmodulestate_global->Mod_singleton;
+ Py_INCREF(state->Mod_singleton);
+ return state->Mod_singleton;
case Pow:
- Py_INCREF(astmodulestate_global->Pow_singleton);
- return astmodulestate_global->Pow_singleton;
+ Py_INCREF(state->Pow_singleton);
+ return state->Pow_singleton;
case LShift:
- Py_INCREF(astmodulestate_global->LShift_singleton);
- return astmodulestate_global->LShift_singleton;
+ Py_INCREF(state->LShift_singleton);
+ return state->LShift_singleton;
case RShift:
- Py_INCREF(astmodulestate_global->RShift_singleton);
- return astmodulestate_global->RShift_singleton;
+ Py_INCREF(state->RShift_singleton);
+ return state->RShift_singleton;
case BitOr:
- Py_INCREF(astmodulestate_global->BitOr_singleton);
- return astmodulestate_global->BitOr_singleton;
+ Py_INCREF(state->BitOr_singleton);
+ return state->BitOr_singleton;
case BitXor:
- Py_INCREF(astmodulestate_global->BitXor_singleton);
- return astmodulestate_global->BitXor_singleton;
+ Py_INCREF(state->BitXor_singleton);
+ return state->BitXor_singleton;
case BitAnd:
- Py_INCREF(astmodulestate_global->BitAnd_singleton);
- return astmodulestate_global->BitAnd_singleton;
+ Py_INCREF(state->BitAnd_singleton);
+ return state->BitAnd_singleton;
case FloorDiv:
- Py_INCREF(astmodulestate_global->FloorDiv_singleton);
- return astmodulestate_global->FloorDiv_singleton;
+ Py_INCREF(state->FloorDiv_singleton);
+ return state->FloorDiv_singleton;
}
Py_UNREACHABLE();
}
-PyObject* ast2obj_unaryop(unaryop_ty o)
+PyObject* ast2obj_unaryop(astmodulestate *state, unaryop_ty o)
{
switch(o) {
case Invert:
- Py_INCREF(astmodulestate_global->Invert_singleton);
- return astmodulestate_global->Invert_singleton;
+ Py_INCREF(state->Invert_singleton);
+ return state->Invert_singleton;
case Not:
- Py_INCREF(astmodulestate_global->Not_singleton);
- return astmodulestate_global->Not_singleton;
+ Py_INCREF(state->Not_singleton);
+ return state->Not_singleton;
case UAdd:
- Py_INCREF(astmodulestate_global->UAdd_singleton);
- return astmodulestate_global->UAdd_singleton;
+ Py_INCREF(state->UAdd_singleton);
+ return state->UAdd_singleton;
case USub:
- Py_INCREF(astmodulestate_global->USub_singleton);
- return astmodulestate_global->USub_singleton;
+ Py_INCREF(state->USub_singleton);
+ return state->USub_singleton;
}
Py_UNREACHABLE();
}
-PyObject* ast2obj_cmpop(cmpop_ty o)
+PyObject* ast2obj_cmpop(astmodulestate *state, cmpop_ty o)
{
switch(o) {
case Eq:
- Py_INCREF(astmodulestate_global->Eq_singleton);
- return astmodulestate_global->Eq_singleton;
+ Py_INCREF(state->Eq_singleton);
+ return state->Eq_singleton;
case NotEq:
- Py_INCREF(astmodulestate_global->NotEq_singleton);
- return astmodulestate_global->NotEq_singleton;
+ Py_INCREF(state->NotEq_singleton);
+ return state->NotEq_singleton;
case Lt:
- Py_INCREF(astmodulestate_global->Lt_singleton);
- return astmodulestate_global->Lt_singleton;
+ Py_INCREF(state->Lt_singleton);
+ return state->Lt_singleton;
case LtE:
- Py_INCREF(astmodulestate_global->LtE_singleton);
- return astmodulestate_global->LtE_singleton;
+ Py_INCREF(state->LtE_singleton);
+ return state->LtE_singleton;
case Gt:
- Py_INCREF(astmodulestate_global->Gt_singleton);
- return astmodulestate_global->Gt_singleton;
+ Py_INCREF(state->Gt_singleton);
+ return state->Gt_singleton;
case GtE:
- Py_INCREF(astmodulestate_global->GtE_singleton);
- return astmodulestate_global->GtE_singleton;
+ Py_INCREF(state->GtE_singleton);
+ return state->GtE_singleton;
case Is:
- Py_INCREF(astmodulestate_global->Is_singleton);
- return astmodulestate_global->Is_singleton;
+ Py_INCREF(state->Is_singleton);
+ return state->Is_singleton;
case IsNot:
- Py_INCREF(astmodulestate_global->IsNot_singleton);
- return astmodulestate_global->IsNot_singleton;
+ Py_INCREF(state->IsNot_singleton);
+ return state->IsNot_singleton;
case In:
- Py_INCREF(astmodulestate_global->In_singleton);
- return astmodulestate_global->In_singleton;
+ Py_INCREF(state->In_singleton);
+ return state->In_singleton;
case NotIn:
- Py_INCREF(astmodulestate_global->NotIn_singleton);
- return astmodulestate_global->NotIn_singleton;
+ Py_INCREF(state->NotIn_singleton);
+ return state->NotIn_singleton;
}
Py_UNREACHABLE();
}
PyObject*
-ast2obj_comprehension(void* _o)
+ast2obj_comprehension(astmodulestate *state, void* _o)
{
comprehension_ty o = (comprehension_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -4745,28 +4769,27 @@ ast2obj_comprehension(void* _o)
if (!o) {
Py_RETURN_NONE;
}
-
- tp = (PyTypeObject *)astmodulestate_global->comprehension_type;
+ tp = (PyTypeObject *)state->comprehension_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) return NULL;
- value = ast2obj_expr(o->target);
+ value = ast2obj_expr(state, o->target);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->target, value) == -1)
+ if (PyObject_SetAttr(result, state->target, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->iter);
+ value = ast2obj_expr(state, o->iter);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->iter, value) == -1)
+ if (PyObject_SetAttr(result, state->iter, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->ifs, ast2obj_expr);
+ value = ast2obj_list(state, o->ifs, ast2obj_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->ifs, value) == -1)
+ if (PyObject_SetAttr(result, state->ifs, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->is_async);
+ value = ast2obj_int(state, o->is_async);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->is_async, value) == -1)
+ if (PyObject_SetAttr(result, state->is_async, value) == -1)
goto failed;
Py_DECREF(value);
return result;
@@ -4777,7 +4800,7 @@ ast2obj_comprehension(void* _o)
}
PyObject*
-ast2obj_excepthandler(void* _o)
+ast2obj_excepthandler(astmodulestate *state, void* _o)
{
excepthandler_ty o = (excepthandler_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -4785,48 +4808,46 @@ ast2obj_excepthandler(void* _o)
if (!o) {
Py_RETURN_NONE;
}
-
switch (o->kind) {
case ExceptHandler_kind:
- tp = (PyTypeObject *)astmodulestate_global->ExceptHandler_type;
+ tp = (PyTypeObject *)state->ExceptHandler_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_expr(o->v.ExceptHandler.type);
+ value = ast2obj_expr(state, o->v.ExceptHandler.type);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->type, value) == -1)
+ if (PyObject_SetAttr(result, state->type, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_identifier(o->v.ExceptHandler.name);
+ value = ast2obj_identifier(state, o->v.ExceptHandler.name);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->name, value) == -1)
+ if (PyObject_SetAttr(result, state->name, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->v.ExceptHandler.body, ast2obj_stmt);
+ value = ast2obj_list(state, o->v.ExceptHandler.body, ast2obj_stmt);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->body, value) == -1)
+ if (PyObject_SetAttr(result, state->body, value) == -1)
goto failed;
Py_DECREF(value);
break;
}
- value = ast2obj_int(o->lineno);
+ value = ast2obj_int(state, o->lineno);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->lineno, value) < 0)
+ if (PyObject_SetAttr(result, state->lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->col_offset);
+ value = ast2obj_int(state, o->col_offset);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->col_offset, value) < 0)
+ if (PyObject_SetAttr(result, state->col_offset, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->end_lineno);
+ value = ast2obj_int(state, o->end_lineno);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->end_lineno, value) < 0)
+ if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->end_col_offset);
+ value = ast2obj_int(state, o->end_col_offset);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->end_col_offset, value)
- < 0)
+ if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
goto failed;
Py_DECREF(value);
return result;
@@ -4837,7 +4858,7 @@ ast2obj_excepthandler(void* _o)
}
PyObject*
-ast2obj_arguments(void* _o)
+ast2obj_arguments(astmodulestate *state, void* _o)
{
arguments_ty o = (arguments_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -4845,46 +4866,42 @@ ast2obj_arguments(void* _o)
if (!o) {
Py_RETURN_NONE;
}
-
- tp = (PyTypeObject *)astmodulestate_global->arguments_type;
+ tp = (PyTypeObject *)state->arguments_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) return NULL;
- value = ast2obj_list(o->posonlyargs, ast2obj_arg);
+ value = ast2obj_list(state, o->posonlyargs, ast2obj_arg);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->posonlyargs, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->posonlyargs, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->args, ast2obj_arg);
+ value = ast2obj_list(state, o->args, ast2obj_arg);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->args, value) == -1)
+ if (PyObject_SetAttr(result, state->args, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_arg(o->vararg);
+ value = ast2obj_arg(state, o->vararg);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->vararg, value) == -1)
+ if (PyObject_SetAttr(result, state->vararg, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->kwonlyargs, ast2obj_arg);
+ value = ast2obj_list(state, o->kwonlyargs, ast2obj_arg);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->kwonlyargs, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->kwonlyargs, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->kw_defaults, ast2obj_expr);
+ value = ast2obj_list(state, o->kw_defaults, ast2obj_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->kw_defaults, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->kw_defaults, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_arg(o->kwarg);
+ value = ast2obj_arg(state, o->kwarg);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->kwarg, value) == -1)
+ if (PyObject_SetAttr(result, state->kwarg, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_list(o->defaults, ast2obj_expr);
+ value = ast2obj_list(state, o->defaults, ast2obj_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->defaults, value) == -1)
+ if (PyObject_SetAttr(result, state->defaults, value) == -1)
goto failed;
Py_DECREF(value);
return result;
@@ -4895,7 +4912,7 @@ ast2obj_arguments(void* _o)
}
PyObject*
-ast2obj_arg(void* _o)
+ast2obj_arg(astmodulestate *state, void* _o)
{
arg_ty o = (arg_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -4903,46 +4920,42 @@ ast2obj_arg(void* _o)
if (!o) {
Py_RETURN_NONE;
}
-
- tp = (PyTypeObject *)astmodulestate_global->arg_type;
+ tp = (PyTypeObject *)state->arg_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) return NULL;
- value = ast2obj_identifier(o->arg);
+ value = ast2obj_identifier(state, o->arg);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->arg, value) == -1)
+ if (PyObject_SetAttr(result, state->arg, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->annotation);
+ value = ast2obj_expr(state, o->annotation);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->annotation, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->annotation, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(o->type_comment);
+ value = ast2obj_string(state, o->type_comment);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->type_comment, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->type_comment, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->lineno);
+ value = ast2obj_int(state, o->lineno);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->lineno, value) < 0)
+ if (PyObject_SetAttr(result, state->lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->col_offset);
+ value = ast2obj_int(state, o->col_offset);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->col_offset, value) < 0)
+ if (PyObject_SetAttr(result, state->col_offset, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->end_lineno);
+ value = ast2obj_int(state, o->end_lineno);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->end_lineno, value) < 0)
+ if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->end_col_offset);
+ value = ast2obj_int(state, o->end_col_offset);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->end_col_offset, value)
- < 0)
+ if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
goto failed;
Py_DECREF(value);
return result;
@@ -4953,7 +4966,7 @@ ast2obj_arg(void* _o)
}
PyObject*
-ast2obj_keyword(void* _o)
+ast2obj_keyword(astmodulestate *state, void* _o)
{
keyword_ty o = (keyword_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -4961,39 +4974,37 @@ ast2obj_keyword(void* _o)
if (!o) {
Py_RETURN_NONE;
}
-
- tp = (PyTypeObject *)astmodulestate_global->keyword_type;
+ tp = (PyTypeObject *)state->keyword_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) return NULL;
- value = ast2obj_identifier(o->arg);
+ value = ast2obj_identifier(state, o->arg);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->arg, value) == -1)
+ if (PyObject_SetAttr(result, state->arg, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->value);
+ value = ast2obj_expr(state, o->value);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->value, value) == -1)
+ if (PyObject_SetAttr(result, state->value, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->lineno);
+ value = ast2obj_int(state, o->lineno);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->lineno, value) < 0)
+ if (PyObject_SetAttr(result, state->lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->col_offset);
+ value = ast2obj_int(state, o->col_offset);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->col_offset, value) < 0)
+ if (PyObject_SetAttr(result, state->col_offset, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->end_lineno);
+ value = ast2obj_int(state, o->end_lineno);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->end_lineno, value) < 0)
+ if (PyObject_SetAttr(result, state->end_lineno, value) < 0)
goto failed;
Py_DECREF(value);
- value = ast2obj_int(o->end_col_offset);
+ value = ast2obj_int(state, o->end_col_offset);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->end_col_offset, value)
- < 0)
+ if (PyObject_SetAttr(result, state->end_col_offset, value) < 0)
goto failed;
Py_DECREF(value);
return result;
@@ -5004,7 +5015,7 @@ ast2obj_keyword(void* _o)
}
PyObject*
-ast2obj_alias(void* _o)
+ast2obj_alias(astmodulestate *state, void* _o)
{
alias_ty o = (alias_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -5012,18 +5023,17 @@ ast2obj_alias(void* _o)
if (!o) {
Py_RETURN_NONE;
}
-
- tp = (PyTypeObject *)astmodulestate_global->alias_type;
+ tp = (PyTypeObject *)state->alias_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) return NULL;
- value = ast2obj_identifier(o->name);
+ value = ast2obj_identifier(state, o->name);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->name, value) == -1)
+ if (PyObject_SetAttr(result, state->name, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_identifier(o->asname);
+ value = ast2obj_identifier(state, o->asname);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->asname, value) == -1)
+ if (PyObject_SetAttr(result, state->asname, value) == -1)
goto failed;
Py_DECREF(value);
return result;
@@ -5034,7 +5044,7 @@ ast2obj_alias(void* _o)
}
PyObject*
-ast2obj_withitem(void* _o)
+ast2obj_withitem(astmodulestate *state, void* _o)
{
withitem_ty o = (withitem_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -5042,20 +5052,17 @@ ast2obj_withitem(void* _o)
if (!o) {
Py_RETURN_NONE;
}
-
- tp = (PyTypeObject *)astmodulestate_global->withitem_type;
+ tp = (PyTypeObject *)state->withitem_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) return NULL;
- value = ast2obj_expr(o->context_expr);
+ value = ast2obj_expr(state, o->context_expr);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->context_expr, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->context_expr, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_expr(o->optional_vars);
+ value = ast2obj_expr(state, o->optional_vars);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->optional_vars, value)
- == -1)
+ if (PyObject_SetAttr(result, state->optional_vars, value) == -1)
goto failed;
Py_DECREF(value);
return result;
@@ -5066,7 +5073,7 @@ ast2obj_withitem(void* _o)
}
PyObject*
-ast2obj_type_ignore(void* _o)
+ast2obj_type_ignore(astmodulestate *state, void* _o)
{
type_ignore_ty o = (type_ignore_ty)_o;
PyObject *result = NULL, *value = NULL;
@@ -5074,21 +5081,19 @@ ast2obj_type_ignore(void* _o)
if (!o) {
Py_RETURN_NONE;
}
-
switch (o->kind) {
case TypeIgnore_kind:
- tp = (PyTypeObject *)astmodulestate_global->TypeIgnore_type;
+ tp = (PyTypeObject *)state->TypeIgnore_type;
result = PyType_GenericNew(tp, NULL, NULL);
if (!result) goto failed;
- value = ast2obj_int(o->v.TypeIgnore.lineno);
+ value = ast2obj_int(state, o->v.TypeIgnore.lineno);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->lineno, value) ==
- -1)
+ if (PyObject_SetAttr(result, state->lineno, value) == -1)
goto failed;
Py_DECREF(value);
- value = ast2obj_string(o->v.TypeIgnore.tag);
+ value = ast2obj_string(state, o->v.TypeIgnore.tag);
if (!value) goto failed;
- if (PyObject_SetAttr(result, astmodulestate_global->tag, value) == -1)
+ if (PyObject_SetAttr(result, state->tag, value) == -1)
goto failed;
Py_DECREF(value);
break;
@@ -5102,7 +5107,7 @@ ast2obj_type_ignore(void* _o)
int
-obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
+obj2ast_mod(astmodulestate *state, PyObject* obj, mod_ty* out, PyArena* arena)
{
int isinstance;
@@ -5113,7 +5118,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
*out = NULL;
return 0;
}
- tp = astmodulestate_global->Module_type;
+ tp = state->Module_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -5122,7 +5127,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
asdl_seq* body;
asdl_seq* type_ignores;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->body, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5144,7 +5149,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
stmt_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_stmt(tmp2, &val, arena);
+ res = obj2ast_stmt(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -5155,8 +5160,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->type_ignores,
- &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->type_ignores, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5178,7 +5182,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
type_ignore_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_type_ignore(tmp2, &val, arena);
+ res = obj2ast_type_ignore(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -5193,7 +5197,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Interactive_type;
+ tp = state->Interactive_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -5201,7 +5205,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
if (isinstance) {
asdl_seq* body;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->body, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5223,7 +5227,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
stmt_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_stmt(tmp2, &val, arena);
+ res = obj2ast_stmt(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -5238,7 +5242,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Expression_type;
+ tp = state->Expression_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -5246,7 +5250,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
if (isinstance) {
expr_ty body;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->body, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5255,7 +5259,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &body, arena);
+ res = obj2ast_expr(state, tmp, &body, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -5263,7 +5267,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->FunctionType_type;
+ tp = state->FunctionType_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -5272,8 +5276,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
asdl_seq* argtypes;
expr_ty returns;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->argtypes, &tmp) <
- 0) {
+ if (_PyObject_LookupAttr(obj, state->argtypes, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5295,7 +5298,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
expr_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_expr(tmp2, &val, arena);
+ res = obj2ast_expr(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -5306,8 +5309,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->returns, &tmp) <
- 0) {
+ if (_PyObject_LookupAttr(obj, state->returns, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5316,7 +5318,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &returns, arena);
+ res = obj2ast_expr(state, tmp, &returns, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -5332,7 +5334,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
}
int
-obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
+obj2ast_stmt(astmodulestate *state, PyObject* obj, stmt_ty* out, PyArena* arena)
{
int isinstance;
@@ -5347,7 +5349,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
*out = NULL;
return 0;
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->lineno, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5356,12 +5358,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &lineno, arena);
+ res = obj2ast_int(state, tmp, &lineno, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->col_offset, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5370,12 +5371,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &col_offset, arena);
+ res = obj2ast_int(state, tmp, &col_offset, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->end_lineno, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -5384,12 +5384,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &end_lineno, arena);
+ res = obj2ast_int(state, tmp, &end_lineno, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->end_col_offset, &tmp)
- < 0) {
+ if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -5398,11 +5397,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &end_col_offset, arena);
+ res = obj2ast_int(state, tmp, &end_col_offset, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- tp = astmodulestate_global->FunctionDef_type;
+ tp = state->FunctionDef_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -5415,7 +5414,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
expr_ty returns;
string type_comment;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->name, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5424,11 +5423,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_identifier(tmp, &name, arena);
+ res = obj2ast_identifier(state, tmp, &name, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->args, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->args, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5437,11 +5436,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_arguments(tmp, &args, arena);
+ res = obj2ast_arguments(state, tmp, &args, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->body, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5463,7 +5462,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
stmt_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_stmt(tmp2, &val, arena);
+ res = obj2ast_stmt(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -5474,8 +5473,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->decorator_list,
- &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->decorator_list, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5497,7 +5495,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
expr_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_expr(tmp2, &val, arena);
+ res = obj2ast_expr(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -5508,8 +5506,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->returns, &tmp) <
- 0) {
+ if (_PyObject_LookupAttr(obj, state->returns, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -5518,12 +5515,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &returns, arena);
+ res = obj2ast_expr(state, tmp, &returns, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->type_comment,
- &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -5532,7 +5528,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_string(tmp, &type_comment, arena);
+ res = obj2ast_string(state, tmp, &type_comment, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -5542,7 +5538,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->AsyncFunctionDef_type;
+ tp = state->AsyncFunctionDef_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -5555,7 +5551,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
expr_ty returns;
string type_comment;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->name, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5564,11 +5560,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_identifier(tmp, &name, arena);
+ res = obj2ast_identifier(state, tmp, &name, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->args, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->args, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5577,11 +5573,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_arguments(tmp, &args, arena);
+ res = obj2ast_arguments(state, tmp, &args, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->body, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5603,7 +5599,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
stmt_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_stmt(tmp2, &val, arena);
+ res = obj2ast_stmt(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -5614,8 +5610,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->decorator_list,
- &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->decorator_list, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5637,7 +5632,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
expr_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_expr(tmp2, &val, arena);
+ res = obj2ast_expr(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -5648,8 +5643,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->returns, &tmp) <
- 0) {
+ if (_PyObject_LookupAttr(obj, state->returns, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -5658,12 +5652,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &returns, arena);
+ res = obj2ast_expr(state, tmp, &returns, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->type_comment,
- &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -5672,7 +5665,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_string(tmp, &type_comment, arena);
+ res = obj2ast_string(state, tmp, &type_comment, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -5682,7 +5675,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->ClassDef_type;
+ tp = state->ClassDef_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -5694,7 +5687,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
asdl_seq* body;
asdl_seq* decorator_list;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->name, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5703,11 +5696,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_identifier(tmp, &name, arena);
+ res = obj2ast_identifier(state, tmp, &name, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->bases, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->bases, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5729,7 +5722,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
expr_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_expr(tmp2, &val, arena);
+ res = obj2ast_expr(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -5740,8 +5733,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->keywords, &tmp) <
- 0) {
+ if (_PyObject_LookupAttr(obj, state->keywords, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5763,7 +5755,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
keyword_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_keyword(tmp2, &val, arena);
+ res = obj2ast_keyword(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -5774,7 +5766,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->body, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5796,7 +5788,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
stmt_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_stmt(tmp2, &val, arena);
+ res = obj2ast_stmt(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -5807,8 +5799,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->decorator_list,
- &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->decorator_list, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5830,7 +5821,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
expr_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_expr(tmp2, &val, arena);
+ res = obj2ast_expr(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -5846,7 +5837,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Return_type;
+ tp = state->Return_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -5854,7 +5845,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (isinstance) {
expr_ty value;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->value, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -5863,7 +5854,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &value, arena);
+ res = obj2ast_expr(state, tmp, &value, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -5872,7 +5863,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Delete_type;
+ tp = state->Delete_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -5880,8 +5871,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (isinstance) {
asdl_seq* targets;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->targets, &tmp) <
- 0) {
+ if (_PyObject_LookupAttr(obj, state->targets, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5903,7 +5893,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
expr_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_expr(tmp2, &val, arena);
+ res = obj2ast_expr(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -5919,7 +5909,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Assign_type;
+ tp = state->Assign_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -5929,8 +5919,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
expr_ty value;
string type_comment;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->targets, &tmp) <
- 0) {
+ if (_PyObject_LookupAttr(obj, state->targets, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5952,7 +5941,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
expr_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_expr(tmp2, &val, arena);
+ res = obj2ast_expr(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -5963,7 +5952,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->value, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -5972,12 +5961,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &value, arena);
+ res = obj2ast_expr(state, tmp, &value, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->type_comment,
- &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -5986,7 +5974,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_string(tmp, &type_comment, arena);
+ res = obj2ast_string(state, tmp, &type_comment, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -5995,7 +5983,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->AugAssign_type;
+ tp = state->AugAssign_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -6005,8 +5993,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
operator_ty op;
expr_ty value;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->target, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6015,11 +6002,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &target, arena);
+ res = obj2ast_expr(state, tmp, &target, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->op, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->op, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6028,11 +6015,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_operator(tmp, &op, arena);
+ res = obj2ast_operator(state, tmp, &op, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->value, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6041,7 +6028,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &value, arena);
+ res = obj2ast_expr(state, tmp, &value, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -6050,7 +6037,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->AnnAssign_type;
+ tp = state->AnnAssign_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -6061,8 +6048,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
expr_ty value;
int simple;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->target, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6071,12 +6057,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &target, arena);
+ res = obj2ast_expr(state, tmp, &target, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->annotation, &tmp)
- < 0) {
+ if (_PyObject_LookupAttr(obj, state->annotation, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6085,11 +6070,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &annotation, arena);
+ res = obj2ast_expr(state, tmp, &annotation, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->value, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -6098,12 +6083,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &value, arena);
+ res = obj2ast_expr(state, tmp, &value, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->simple, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->simple, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6112,7 +6096,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &simple, arena);
+ res = obj2ast_int(state, tmp, &simple, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -6121,7 +6105,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->For_type;
+ tp = state->For_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -6133,8 +6117,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
asdl_seq* orelse;
string type_comment;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->target, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6143,11 +6126,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &target, arena);
+ res = obj2ast_expr(state, tmp, &target, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->iter, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->iter, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6156,11 +6139,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &iter, arena);
+ res = obj2ast_expr(state, tmp, &iter, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->body, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6182,7 +6165,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
stmt_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_stmt(tmp2, &val, arena);
+ res = obj2ast_stmt(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -6193,8 +6176,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->orelse, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6216,7 +6198,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
stmt_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_stmt(tmp2, &val, arena);
+ res = obj2ast_stmt(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -6227,8 +6209,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->type_comment,
- &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -6237,7 +6218,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_string(tmp, &type_comment, arena);
+ res = obj2ast_string(state, tmp, &type_comment, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -6246,7 +6227,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->AsyncFor_type;
+ tp = state->AsyncFor_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -6258,8 +6239,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
asdl_seq* orelse;
string type_comment;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->target, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6268,11 +6248,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &target, arena);
+ res = obj2ast_expr(state, tmp, &target, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->iter, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->iter, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6281,11 +6261,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &iter, arena);
+ res = obj2ast_expr(state, tmp, &iter, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->body, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6307,7 +6287,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
stmt_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_stmt(tmp2, &val, arena);
+ res = obj2ast_stmt(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -6318,8 +6298,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->orelse, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6341,7 +6320,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
stmt_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_stmt(tmp2, &val, arena);
+ res = obj2ast_stmt(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -6352,8 +6331,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->type_comment,
- &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -6362,7 +6340,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_string(tmp, &type_comment, arena);
+ res = obj2ast_string(state, tmp, &type_comment, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -6371,7 +6349,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->While_type;
+ tp = state->While_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -6381,7 +6359,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
asdl_seq* body;
asdl_seq* orelse;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->test, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->test, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6390,11 +6368,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &test, arena);
+ res = obj2ast_expr(state, tmp, &test, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->body, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6416,7 +6394,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
stmt_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_stmt(tmp2, &val, arena);
+ res = obj2ast_stmt(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -6427,8 +6405,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->orelse, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6450,7 +6427,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
stmt_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_stmt(tmp2, &val, arena);
+ res = obj2ast_stmt(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -6466,7 +6443,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->If_type;
+ tp = state->If_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -6476,7 +6453,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
asdl_seq* body;
asdl_seq* orelse;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->test, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->test, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6485,11 +6462,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &test, arena);
+ res = obj2ast_expr(state, tmp, &test, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->body, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6511,7 +6488,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
stmt_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_stmt(tmp2, &val, arena);
+ res = obj2ast_stmt(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -6522,8 +6499,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->orelse, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6545,7 +6521,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
stmt_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_stmt(tmp2, &val, arena);
+ res = obj2ast_stmt(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -6561,7 +6537,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->With_type;
+ tp = state->With_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -6571,7 +6547,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
asdl_seq* body;
string type_comment;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->items, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->items, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6593,7 +6569,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
withitem_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_withitem(tmp2, &val, arena);
+ res = obj2ast_withitem(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -6604,7 +6580,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->body, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6626,7 +6602,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
stmt_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_stmt(tmp2, &val, arena);
+ res = obj2ast_stmt(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -6637,8 +6613,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->type_comment,
- &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -6647,7 +6622,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_string(tmp, &type_comment, arena);
+ res = obj2ast_string(state, tmp, &type_comment, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -6656,7 +6631,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->AsyncWith_type;
+ tp = state->AsyncWith_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -6666,7 +6641,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
asdl_seq* body;
string type_comment;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->items, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->items, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6688,7 +6663,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
withitem_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_withitem(tmp2, &val, arena);
+ res = obj2ast_withitem(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -6699,7 +6674,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->body, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6721,7 +6696,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
stmt_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_stmt(tmp2, &val, arena);
+ res = obj2ast_stmt(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -6732,8 +6707,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->type_comment,
- &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -6742,7 +6716,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_string(tmp, &type_comment, arena);
+ res = obj2ast_string(state, tmp, &type_comment, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -6751,7 +6725,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Raise_type;
+ tp = state->Raise_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -6760,7 +6734,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
expr_ty exc;
expr_ty cause;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->exc, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->exc, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -6769,11 +6743,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &exc, arena);
+ res = obj2ast_expr(state, tmp, &exc, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->cause, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->cause, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -6782,7 +6756,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &cause, arena);
+ res = obj2ast_expr(state, tmp, &cause, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -6791,7 +6765,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Try_type;
+ tp = state->Try_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -6802,7 +6776,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
asdl_seq* orelse;
asdl_seq* finalbody;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->body, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6824,7 +6798,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
stmt_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_stmt(tmp2, &val, arena);
+ res = obj2ast_stmt(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -6835,8 +6809,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->handlers, &tmp) <
- 0) {
+ if (_PyObject_LookupAttr(obj, state->handlers, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6858,7 +6831,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
excepthandler_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_excepthandler(tmp2, &val, arena);
+ res = obj2ast_excepthandler(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -6869,8 +6842,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->orelse, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6892,7 +6864,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
stmt_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_stmt(tmp2, &val, arena);
+ res = obj2ast_stmt(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -6903,8 +6875,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->finalbody, &tmp) <
- 0) {
+ if (_PyObject_LookupAttr(obj, state->finalbody, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6926,7 +6897,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
stmt_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_stmt(tmp2, &val, arena);
+ res = obj2ast_stmt(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -6942,7 +6913,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Assert_type;
+ tp = state->Assert_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -6951,7 +6922,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
expr_ty test;
expr_ty msg;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->test, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->test, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -6960,11 +6931,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &test, arena);
+ res = obj2ast_expr(state, tmp, &test, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->msg, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->msg, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -6973,7 +6944,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &msg, arena);
+ res = obj2ast_expr(state, tmp, &msg, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -6982,7 +6953,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Import_type;
+ tp = state->Import_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -6990,7 +6961,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (isinstance) {
asdl_seq* names;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->names, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7012,7 +6983,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
alias_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_alias(tmp2, &val, arena);
+ res = obj2ast_alias(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -7028,7 +6999,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->ImportFrom_type;
+ tp = state->ImportFrom_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -7038,8 +7009,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
asdl_seq* names;
int level;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->module, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->module, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -7048,11 +7018,11 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_identifier(tmp, &module, arena);
+ res = obj2ast_identifier(state, tmp, &module, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->names, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7074,7 +7044,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
alias_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_alias(tmp2, &val, arena);
+ res = obj2ast_alias(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -7085,7 +7055,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->level, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->level, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -7094,7 +7064,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &level, arena);
+ res = obj2ast_int(state, tmp, &level, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -7103,7 +7073,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Global_type;
+ tp = state->Global_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -7111,7 +7081,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (isinstance) {
asdl_seq* names;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->names, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7133,7 +7103,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
identifier val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_identifier(tmp2, &val, arena);
+ res = obj2ast_identifier(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -7149,7 +7119,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Nonlocal_type;
+ tp = state->Nonlocal_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -7157,7 +7127,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (isinstance) {
asdl_seq* names;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->names, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->names, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7179,7 +7149,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
identifier val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_identifier(tmp2, &val, arena);
+ res = obj2ast_identifier(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -7195,7 +7165,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Expr_type;
+ tp = state->Expr_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -7203,7 +7173,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (isinstance) {
expr_ty value;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->value, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7212,7 +7182,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &value, arena);
+ res = obj2ast_expr(state, tmp, &value, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -7221,7 +7191,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Pass_type;
+ tp = state->Pass_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -7232,7 +7202,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Break_type;
+ tp = state->Break_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -7243,7 +7213,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Continue_type;
+ tp = state->Continue_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -7262,7 +7232,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
}
int
-obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
+obj2ast_expr(astmodulestate *state, PyObject* obj, expr_ty* out, PyArena* arena)
{
int isinstance;
@@ -7277,7 +7247,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
*out = NULL;
return 0;
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->lineno, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7286,12 +7256,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &lineno, arena);
+ res = obj2ast_int(state, tmp, &lineno, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->col_offset, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7300,12 +7269,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &col_offset, arena);
+ res = obj2ast_int(state, tmp, &col_offset, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->end_lineno, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -7314,12 +7282,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &end_lineno, arena);
+ res = obj2ast_int(state, tmp, &end_lineno, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->end_col_offset, &tmp)
- < 0) {
+ if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -7328,11 +7295,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &end_col_offset, arena);
+ res = obj2ast_int(state, tmp, &end_col_offset, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- tp = astmodulestate_global->BoolOp_type;
+ tp = state->BoolOp_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -7341,7 +7308,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
boolop_ty op;
asdl_seq* values;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->op, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->op, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7350,12 +7317,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_boolop(tmp, &op, arena);
+ res = obj2ast_boolop(state, tmp, &op, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->values, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->values, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7377,7 +7343,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
expr_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_expr(tmp2, &val, arena);
+ res = obj2ast_expr(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -7393,7 +7359,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->NamedExpr_type;
+ tp = state->NamedExpr_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -7402,8 +7368,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
expr_ty target;
expr_ty value;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->target, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7412,11 +7377,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &target, arena);
+ res = obj2ast_expr(state, tmp, &target, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->value, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7425,7 +7390,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &value, arena);
+ res = obj2ast_expr(state, tmp, &value, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -7434,7 +7399,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->BinOp_type;
+ tp = state->BinOp_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -7444,7 +7409,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
operator_ty op;
expr_ty right;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->left, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->left, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7453,11 +7418,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &left, arena);
+ res = obj2ast_expr(state, tmp, &left, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->op, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->op, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7466,11 +7431,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_operator(tmp, &op, arena);
+ res = obj2ast_operator(state, tmp, &op, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->right, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->right, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7479,7 +7444,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &right, arena);
+ res = obj2ast_expr(state, tmp, &right, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -7488,7 +7453,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->UnaryOp_type;
+ tp = state->UnaryOp_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -7497,7 +7462,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
unaryop_ty op;
expr_ty operand;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->op, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->op, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7506,12 +7471,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_unaryop(tmp, &op, arena);
+ res = obj2ast_unaryop(state, tmp, &op, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->operand, &tmp) <
- 0) {
+ if (_PyObject_LookupAttr(obj, state->operand, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7520,7 +7484,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &operand, arena);
+ res = obj2ast_expr(state, tmp, &operand, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -7529,7 +7493,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Lambda_type;
+ tp = state->Lambda_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -7538,7 +7502,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
arguments_ty args;
expr_ty body;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->args, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->args, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7547,11 +7511,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_arguments(tmp, &args, arena);
+ res = obj2ast_arguments(state, tmp, &args, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->body, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7560,7 +7524,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &body, arena);
+ res = obj2ast_expr(state, tmp, &body, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -7569,7 +7533,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->IfExp_type;
+ tp = state->IfExp_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -7579,7 +7543,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
expr_ty body;
expr_ty orelse;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->test, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->test, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7588,11 +7552,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &test, arena);
+ res = obj2ast_expr(state, tmp, &test, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->body, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7601,12 +7565,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &body, arena);
+ res = obj2ast_expr(state, tmp, &body, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->orelse, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->orelse, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7615,7 +7578,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &orelse, arena);
+ res = obj2ast_expr(state, tmp, &orelse, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -7624,7 +7587,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Dict_type;
+ tp = state->Dict_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -7633,7 +7596,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
asdl_seq* keys;
asdl_seq* values;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->keys, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->keys, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7655,7 +7618,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
expr_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_expr(tmp2, &val, arena);
+ res = obj2ast_expr(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -7666,8 +7629,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->values, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->values, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7689,7 +7651,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
expr_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_expr(tmp2, &val, arena);
+ res = obj2ast_expr(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -7705,7 +7667,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Set_type;
+ tp = state->Set_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -7713,7 +7675,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (isinstance) {
asdl_seq* elts;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->elts, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->elts, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7735,7 +7697,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
expr_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_expr(tmp2, &val, arena);
+ res = obj2ast_expr(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -7750,7 +7712,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->ListComp_type;
+ tp = state->ListComp_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -7759,7 +7721,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
expr_ty elt;
asdl_seq* generators;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->elt, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->elt, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7768,12 +7730,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &elt, arena);
+ res = obj2ast_expr(state, tmp, &elt, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->generators, &tmp)
- < 0) {
+ if (_PyObject_LookupAttr(obj, state->generators, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7795,7 +7756,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
comprehension_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_comprehension(tmp2, &val, arena);
+ res = obj2ast_comprehension(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -7811,7 +7772,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->SetComp_type;
+ tp = state->SetComp_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -7820,7 +7781,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
expr_ty elt;
asdl_seq* generators;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->elt, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->elt, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7829,12 +7790,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &elt, arena);
+ res = obj2ast_expr(state, tmp, &elt, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->generators, &tmp)
- < 0) {
+ if (_PyObject_LookupAttr(obj, state->generators, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7856,7 +7816,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
comprehension_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_comprehension(tmp2, &val, arena);
+ res = obj2ast_comprehension(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -7872,7 +7832,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->DictComp_type;
+ tp = state->DictComp_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -7882,7 +7842,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
expr_ty value;
asdl_seq* generators;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->key, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->key, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7891,11 +7851,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &key, arena);
+ res = obj2ast_expr(state, tmp, &key, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->value, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7904,12 +7864,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &value, arena);
+ res = obj2ast_expr(state, tmp, &value, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->generators, &tmp)
- < 0) {
+ if (_PyObject_LookupAttr(obj, state->generators, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7931,7 +7890,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
comprehension_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_comprehension(tmp2, &val, arena);
+ res = obj2ast_comprehension(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -7947,7 +7906,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->GeneratorExp_type;
+ tp = state->GeneratorExp_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -7956,7 +7915,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
expr_ty elt;
asdl_seq* generators;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->elt, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->elt, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7965,12 +7924,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &elt, arena);
+ res = obj2ast_expr(state, tmp, &elt, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->generators, &tmp)
- < 0) {
+ if (_PyObject_LookupAttr(obj, state->generators, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -7992,7 +7950,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
comprehension_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_comprehension(tmp2, &val, arena);
+ res = obj2ast_comprehension(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -8008,7 +7966,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Await_type;
+ tp = state->Await_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -8016,7 +7974,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (isinstance) {
expr_ty value;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->value, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8025,7 +7983,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &value, arena);
+ res = obj2ast_expr(state, tmp, &value, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -8034,7 +7992,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Yield_type;
+ tp = state->Yield_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -8042,7 +8000,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (isinstance) {
expr_ty value;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->value, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -8051,7 +8009,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &value, arena);
+ res = obj2ast_expr(state, tmp, &value, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -8060,7 +8018,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->YieldFrom_type;
+ tp = state->YieldFrom_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -8068,7 +8026,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (isinstance) {
expr_ty value;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->value, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8077,7 +8035,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &value, arena);
+ res = obj2ast_expr(state, tmp, &value, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -8086,7 +8044,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Compare_type;
+ tp = state->Compare_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -8096,7 +8054,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
asdl_int_seq* ops;
asdl_seq* comparators;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->left, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->left, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8105,11 +8063,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &left, arena);
+ res = obj2ast_expr(state, tmp, &left, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->ops, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->ops, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8131,7 +8089,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
cmpop_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_cmpop(tmp2, &val, arena);
+ res = obj2ast_cmpop(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -8142,8 +8100,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->comparators, &tmp)
- < 0) {
+ if (_PyObject_LookupAttr(obj, state->comparators, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8165,7 +8122,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
expr_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_expr(tmp2, &val, arena);
+ res = obj2ast_expr(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -8181,7 +8138,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Call_type;
+ tp = state->Call_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -8191,7 +8148,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
asdl_seq* args;
asdl_seq* keywords;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->func, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->func, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8200,11 +8157,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &func, arena);
+ res = obj2ast_expr(state, tmp, &func, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->args, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->args, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8226,7 +8183,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
expr_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_expr(tmp2, &val, arena);
+ res = obj2ast_expr(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -8237,8 +8194,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->keywords, &tmp) <
- 0) {
+ if (_PyObject_LookupAttr(obj, state->keywords, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8260,7 +8216,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
keyword_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_keyword(tmp2, &val, arena);
+ res = obj2ast_keyword(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -8276,7 +8232,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->FormattedValue_type;
+ tp = state->FormattedValue_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -8286,7 +8242,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
int conversion;
expr_ty format_spec;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->value, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8295,12 +8251,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &value, arena);
+ res = obj2ast_expr(state, tmp, &value, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->conversion, &tmp)
- < 0) {
+ if (_PyObject_LookupAttr(obj, state->conversion, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -8309,12 +8264,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &conversion, arena);
+ res = obj2ast_int(state, tmp, &conversion, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->format_spec, &tmp)
- < 0) {
+ if (_PyObject_LookupAttr(obj, state->format_spec, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -8323,7 +8277,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &format_spec, arena);
+ res = obj2ast_expr(state, tmp, &format_spec, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -8332,7 +8286,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->JoinedStr_type;
+ tp = state->JoinedStr_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -8340,8 +8294,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (isinstance) {
asdl_seq* values;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->values, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->values, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8363,7 +8316,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
expr_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_expr(tmp2, &val, arena);
+ res = obj2ast_expr(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -8379,7 +8332,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Constant_type;
+ tp = state->Constant_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -8388,7 +8341,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
constant value;
string kind;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->value, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8397,11 +8350,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_constant(tmp, &value, arena);
+ res = obj2ast_constant(state, tmp, &value, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->kind, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->kind, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -8410,7 +8363,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_string(tmp, &kind, arena);
+ res = obj2ast_string(state, tmp, &kind, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -8419,7 +8372,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Attribute_type;
+ tp = state->Attribute_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -8429,7 +8382,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
identifier attr;
expr_context_ty ctx;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->value, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8438,11 +8391,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &value, arena);
+ res = obj2ast_expr(state, tmp, &value, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->attr, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->attr, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8451,11 +8404,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_identifier(tmp, &attr, arena);
+ res = obj2ast_identifier(state, tmp, &attr, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->ctx, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->ctx, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8464,7 +8417,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr_context(tmp, &ctx, arena);
+ res = obj2ast_expr_context(state, tmp, &ctx, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -8473,7 +8426,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Subscript_type;
+ tp = state->Subscript_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -8483,7 +8436,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
expr_ty slice;
expr_context_ty ctx;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->value, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8492,11 +8445,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &value, arena);
+ res = obj2ast_expr(state, tmp, &value, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->slice, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->slice, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8505,11 +8458,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &slice, arena);
+ res = obj2ast_expr(state, tmp, &slice, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->ctx, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->ctx, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8518,7 +8471,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr_context(tmp, &ctx, arena);
+ res = obj2ast_expr_context(state, tmp, &ctx, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -8527,7 +8480,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Starred_type;
+ tp = state->Starred_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -8536,7 +8489,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
expr_ty value;
expr_context_ty ctx;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->value, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8545,11 +8498,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &value, arena);
+ res = obj2ast_expr(state, tmp, &value, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->ctx, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->ctx, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8558,7 +8511,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr_context(tmp, &ctx, arena);
+ res = obj2ast_expr_context(state, tmp, &ctx, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -8567,7 +8520,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Name_type;
+ tp = state->Name_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -8576,7 +8529,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
identifier id;
expr_context_ty ctx;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->id, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->id, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8585,11 +8538,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_identifier(tmp, &id, arena);
+ res = obj2ast_identifier(state, tmp, &id, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->ctx, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->ctx, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8598,7 +8551,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr_context(tmp, &ctx, arena);
+ res = obj2ast_expr_context(state, tmp, &ctx, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -8607,7 +8560,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->List_type;
+ tp = state->List_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -8616,7 +8569,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
asdl_seq* elts;
expr_context_ty ctx;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->elts, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->elts, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8638,7 +8591,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
expr_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_expr(tmp2, &val, arena);
+ res = obj2ast_expr(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -8649,7 +8602,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->ctx, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->ctx, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8658,7 +8611,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr_context(tmp, &ctx, arena);
+ res = obj2ast_expr_context(state, tmp, &ctx, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -8667,7 +8620,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Tuple_type;
+ tp = state->Tuple_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -8676,7 +8629,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
asdl_seq* elts;
expr_context_ty ctx;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->elts, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->elts, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8698,7 +8651,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
expr_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_expr(tmp2, &val, arena);
+ res = obj2ast_expr(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -8709,7 +8662,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->ctx, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->ctx, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -8718,7 +8671,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr_context(tmp, &ctx, arena);
+ res = obj2ast_expr_context(state, tmp, &ctx, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -8727,7 +8680,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
if (*out == NULL) goto failed;
return 0;
}
- tp = astmodulestate_global->Slice_type;
+ tp = state->Slice_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -8737,7 +8690,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
expr_ty upper;
expr_ty step;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->lower, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->lower, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -8746,11 +8699,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &lower, arena);
+ res = obj2ast_expr(state, tmp, &lower, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->upper, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->upper, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -8759,11 +8712,11 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &upper, arena);
+ res = obj2ast_expr(state, tmp, &upper, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->step, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->step, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -8772,7 +8725,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &step, arena);
+ res = obj2ast_expr(state, tmp, &step, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -8789,11 +8742,12 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
}
int
-obj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena* arena)
+obj2ast_expr_context(astmodulestate *state, PyObject* obj, expr_context_ty*
+ out, PyArena* arena)
{
int isinstance;
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->Load_type);
+ isinstance = PyObject_IsInstance(obj, state->Load_type);
if (isinstance == -1) {
return 1;
}
@@ -8801,7 +8755,7 @@ obj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena* arena)
*out = Load;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->Store_type);
+ isinstance = PyObject_IsInstance(obj, state->Store_type);
if (isinstance == -1) {
return 1;
}
@@ -8809,7 +8763,7 @@ obj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena* arena)
*out = Store;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->Del_type);
+ isinstance = PyObject_IsInstance(obj, state->Del_type);
if (isinstance == -1) {
return 1;
}
@@ -8823,11 +8777,12 @@ obj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena* arena)
}
int
-obj2ast_boolop(PyObject* obj, boolop_ty* out, PyArena* arena)
+obj2ast_boolop(astmodulestate *state, PyObject* obj, boolop_ty* out, PyArena*
+ arena)
{
int isinstance;
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->And_type);
+ isinstance = PyObject_IsInstance(obj, state->And_type);
if (isinstance == -1) {
return 1;
}
@@ -8835,7 +8790,7 @@ obj2ast_boolop(PyObject* obj, boolop_ty* out, PyArena* arena)
*out = And;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->Or_type);
+ isinstance = PyObject_IsInstance(obj, state->Or_type);
if (isinstance == -1) {
return 1;
}
@@ -8849,11 +8804,12 @@ obj2ast_boolop(PyObject* obj, boolop_ty* out, PyArena* arena)
}
int
-obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)
+obj2ast_operator(astmodulestate *state, PyObject* obj, operator_ty* out,
+ PyArena* arena)
{
int isinstance;
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->Add_type);
+ isinstance = PyObject_IsInstance(obj, state->Add_type);
if (isinstance == -1) {
return 1;
}
@@ -8861,7 +8817,7 @@ obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)
*out = Add;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->Sub_type);
+ isinstance = PyObject_IsInstance(obj, state->Sub_type);
if (isinstance == -1) {
return 1;
}
@@ -8869,7 +8825,7 @@ obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)
*out = Sub;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->Mult_type);
+ isinstance = PyObject_IsInstance(obj, state->Mult_type);
if (isinstance == -1) {
return 1;
}
@@ -8877,7 +8833,7 @@ obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)
*out = Mult;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->MatMult_type);
+ isinstance = PyObject_IsInstance(obj, state->MatMult_type);
if (isinstance == -1) {
return 1;
}
@@ -8885,7 +8841,7 @@ obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)
*out = MatMult;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->Div_type);
+ isinstance = PyObject_IsInstance(obj, state->Div_type);
if (isinstance == -1) {
return 1;
}
@@ -8893,7 +8849,7 @@ obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)
*out = Div;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->Mod_type);
+ isinstance = PyObject_IsInstance(obj, state->Mod_type);
if (isinstance == -1) {
return 1;
}
@@ -8901,7 +8857,7 @@ obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)
*out = Mod;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->Pow_type);
+ isinstance = PyObject_IsInstance(obj, state->Pow_type);
if (isinstance == -1) {
return 1;
}
@@ -8909,7 +8865,7 @@ obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)
*out = Pow;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->LShift_type);
+ isinstance = PyObject_IsInstance(obj, state->LShift_type);
if (isinstance == -1) {
return 1;
}
@@ -8917,7 +8873,7 @@ obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)
*out = LShift;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->RShift_type);
+ isinstance = PyObject_IsInstance(obj, state->RShift_type);
if (isinstance == -1) {
return 1;
}
@@ -8925,7 +8881,7 @@ obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)
*out = RShift;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->BitOr_type);
+ isinstance = PyObject_IsInstance(obj, state->BitOr_type);
if (isinstance == -1) {
return 1;
}
@@ -8933,7 +8889,7 @@ obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)
*out = BitOr;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->BitXor_type);
+ isinstance = PyObject_IsInstance(obj, state->BitXor_type);
if (isinstance == -1) {
return 1;
}
@@ -8941,7 +8897,7 @@ obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)
*out = BitXor;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->BitAnd_type);
+ isinstance = PyObject_IsInstance(obj, state->BitAnd_type);
if (isinstance == -1) {
return 1;
}
@@ -8949,7 +8905,7 @@ obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)
*out = BitAnd;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->FloorDiv_type);
+ isinstance = PyObject_IsInstance(obj, state->FloorDiv_type);
if (isinstance == -1) {
return 1;
}
@@ -8963,11 +8919,12 @@ obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena)
}
int
-obj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena)
+obj2ast_unaryop(astmodulestate *state, PyObject* obj, unaryop_ty* out, PyArena*
+ arena)
{
int isinstance;
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->Invert_type);
+ isinstance = PyObject_IsInstance(obj, state->Invert_type);
if (isinstance == -1) {
return 1;
}
@@ -8975,7 +8932,7 @@ obj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena)
*out = Invert;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->Not_type);
+ isinstance = PyObject_IsInstance(obj, state->Not_type);
if (isinstance == -1) {
return 1;
}
@@ -8983,7 +8940,7 @@ obj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena)
*out = Not;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->UAdd_type);
+ isinstance = PyObject_IsInstance(obj, state->UAdd_type);
if (isinstance == -1) {
return 1;
}
@@ -8991,7 +8948,7 @@ obj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena)
*out = UAdd;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->USub_type);
+ isinstance = PyObject_IsInstance(obj, state->USub_type);
if (isinstance == -1) {
return 1;
}
@@ -9005,11 +8962,12 @@ obj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena)
}
int
-obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena)
+obj2ast_cmpop(astmodulestate *state, PyObject* obj, cmpop_ty* out, PyArena*
+ arena)
{
int isinstance;
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->Eq_type);
+ isinstance = PyObject_IsInstance(obj, state->Eq_type);
if (isinstance == -1) {
return 1;
}
@@ -9017,7 +8975,7 @@ obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena)
*out = Eq;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->NotEq_type);
+ isinstance = PyObject_IsInstance(obj, state->NotEq_type);
if (isinstance == -1) {
return 1;
}
@@ -9025,7 +8983,7 @@ obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena)
*out = NotEq;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->Lt_type);
+ isinstance = PyObject_IsInstance(obj, state->Lt_type);
if (isinstance == -1) {
return 1;
}
@@ -9033,7 +8991,7 @@ obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena)
*out = Lt;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->LtE_type);
+ isinstance = PyObject_IsInstance(obj, state->LtE_type);
if (isinstance == -1) {
return 1;
}
@@ -9041,7 +8999,7 @@ obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena)
*out = LtE;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->Gt_type);
+ isinstance = PyObject_IsInstance(obj, state->Gt_type);
if (isinstance == -1) {
return 1;
}
@@ -9049,7 +9007,7 @@ obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena)
*out = Gt;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->GtE_type);
+ isinstance = PyObject_IsInstance(obj, state->GtE_type);
if (isinstance == -1) {
return 1;
}
@@ -9057,7 +9015,7 @@ obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena)
*out = GtE;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->Is_type);
+ isinstance = PyObject_IsInstance(obj, state->Is_type);
if (isinstance == -1) {
return 1;
}
@@ -9065,7 +9023,7 @@ obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena)
*out = Is;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->IsNot_type);
+ isinstance = PyObject_IsInstance(obj, state->IsNot_type);
if (isinstance == -1) {
return 1;
}
@@ -9073,7 +9031,7 @@ obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena)
*out = IsNot;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->In_type);
+ isinstance = PyObject_IsInstance(obj, state->In_type);
if (isinstance == -1) {
return 1;
}
@@ -9081,7 +9039,7 @@ obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena)
*out = In;
return 0;
}
- isinstance = PyObject_IsInstance(obj, astmodulestate_global->NotIn_type);
+ isinstance = PyObject_IsInstance(obj, state->NotIn_type);
if (isinstance == -1) {
return 1;
}
@@ -9095,7 +9053,8 @@ obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena)
}
int
-obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena)
+obj2ast_comprehension(astmodulestate *state, PyObject* obj, comprehension_ty*
+ out, PyArena* arena)
{
PyObject* tmp = NULL;
expr_ty target;
@@ -9103,7 +9062,7 @@ obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena)
asdl_seq* ifs;
int is_async;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->target, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->target, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9112,11 +9071,11 @@ obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &target, arena);
+ res = obj2ast_expr(state, tmp, &target, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->iter, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->iter, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9125,11 +9084,11 @@ obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &iter, arena);
+ res = obj2ast_expr(state, tmp, &iter, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->ifs, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->ifs, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9151,7 +9110,7 @@ obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena)
expr_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_expr(tmp2, &val, arena);
+ res = obj2ast_expr(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -9162,7 +9121,7 @@ obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->is_async, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->is_async, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9171,7 +9130,7 @@ obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &is_async, arena);
+ res = obj2ast_int(state, tmp, &is_async, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -9183,7 +9142,8 @@ obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena)
}
int
-obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena)
+obj2ast_excepthandler(astmodulestate *state, PyObject* obj, excepthandler_ty*
+ out, PyArena* arena)
{
int isinstance;
@@ -9198,7 +9158,7 @@ obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena)
*out = NULL;
return 0;
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->lineno, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9207,12 +9167,11 @@ obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &lineno, arena);
+ res = obj2ast_int(state, tmp, &lineno, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->col_offset, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9221,12 +9180,11 @@ obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &col_offset, arena);
+ res = obj2ast_int(state, tmp, &col_offset, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->end_lineno, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -9235,12 +9193,11 @@ obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &end_lineno, arena);
+ res = obj2ast_int(state, tmp, &end_lineno, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->end_col_offset, &tmp)
- < 0) {
+ if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -9249,11 +9206,11 @@ obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &end_col_offset, arena);
+ res = obj2ast_int(state, tmp, &end_col_offset, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- tp = astmodulestate_global->ExceptHandler_type;
+ tp = state->ExceptHandler_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -9263,7 +9220,7 @@ obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena)
identifier name;
asdl_seq* body;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->type, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->type, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -9272,11 +9229,11 @@ obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &type, arena);
+ res = obj2ast_expr(state, tmp, &type, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->name, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -9285,11 +9242,11 @@ obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_identifier(tmp, &name, arena);
+ res = obj2ast_identifier(state, tmp, &name, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->body, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->body, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9311,7 +9268,7 @@ obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena)
stmt_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_stmt(tmp2, &val, arena);
+ res = obj2ast_stmt(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -9335,7 +9292,8 @@ obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena)
}
int
-obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
+obj2ast_arguments(astmodulestate *state, PyObject* obj, arguments_ty* out,
+ PyArena* arena)
{
PyObject* tmp = NULL;
asdl_seq* posonlyargs;
@@ -9346,8 +9304,7 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
arg_ty kwarg;
asdl_seq* defaults;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->posonlyargs, &tmp) <
- 0) {
+ if (_PyObject_LookupAttr(obj, state->posonlyargs, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9369,7 +9326,7 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
arg_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_arg(tmp2, &val, arena);
+ res = obj2ast_arg(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -9380,7 +9337,7 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->args, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->args, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9402,7 +9359,7 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
arg_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_arg(tmp2, &val, arena);
+ res = obj2ast_arg(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -9413,7 +9370,7 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->vararg, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->vararg, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -9422,12 +9379,11 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_arg(tmp, &vararg, arena);
+ res = obj2ast_arg(state, tmp, &vararg, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->kwonlyargs, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->kwonlyargs, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9449,7 +9405,7 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
arg_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_arg(tmp2, &val, arena);
+ res = obj2ast_arg(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -9460,8 +9416,7 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->kw_defaults, &tmp) <
- 0) {
+ if (_PyObject_LookupAttr(obj, state->kw_defaults, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9483,7 +9438,7 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
expr_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_expr(tmp2, &val, arena);
+ res = obj2ast_expr(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -9494,7 +9449,7 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
}
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->kwarg, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->kwarg, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -9503,11 +9458,11 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_arg(tmp, &kwarg, arena);
+ res = obj2ast_arg(state, tmp, &kwarg, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->defaults, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->defaults, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9529,7 +9484,7 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
expr_ty val;
PyObject *tmp2 = PyList_GET_ITEM(tmp, i);
Py_INCREF(tmp2);
- res = obj2ast_expr(tmp2, &val, arena);
+ res = obj2ast_expr(state, tmp2, &val, arena);
Py_DECREF(tmp2);
if (res != 0) goto failed;
if (len != PyList_GET_SIZE(tmp)) {
@@ -9549,7 +9504,7 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
}
int
-obj2ast_arg(PyObject* obj, arg_ty* out, PyArena* arena)
+obj2ast_arg(astmodulestate *state, PyObject* obj, arg_ty* out, PyArena* arena)
{
PyObject* tmp = NULL;
identifier arg;
@@ -9560,7 +9515,7 @@ obj2ast_arg(PyObject* obj, arg_ty* out, PyArena* arena)
int end_lineno;
int end_col_offset;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->arg, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->arg, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9569,12 +9524,11 @@ obj2ast_arg(PyObject* obj, arg_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_identifier(tmp, &arg, arena);
+ res = obj2ast_identifier(state, tmp, &arg, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->annotation, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->annotation, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -9583,12 +9537,11 @@ obj2ast_arg(PyObject* obj, arg_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &annotation, arena);
+ res = obj2ast_expr(state, tmp, &annotation, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->type_comment, &tmp) <
- 0) {
+ if (_PyObject_LookupAttr(obj, state->type_comment, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -9597,11 +9550,11 @@ obj2ast_arg(PyObject* obj, arg_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_string(tmp, &type_comment, arena);
+ res = obj2ast_string(state, tmp, &type_comment, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->lineno, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9610,12 +9563,11 @@ obj2ast_arg(PyObject* obj, arg_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &lineno, arena);
+ res = obj2ast_int(state, tmp, &lineno, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->col_offset, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9624,12 +9576,11 @@ obj2ast_arg(PyObject* obj, arg_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &col_offset, arena);
+ res = obj2ast_int(state, tmp, &col_offset, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->end_lineno, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -9638,12 +9589,11 @@ obj2ast_arg(PyObject* obj, arg_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &end_lineno, arena);
+ res = obj2ast_int(state, tmp, &end_lineno, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->end_col_offset, &tmp)
- < 0) {
+ if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -9652,7 +9602,7 @@ obj2ast_arg(PyObject* obj, arg_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &end_col_offset, arena);
+ res = obj2ast_int(state, tmp, &end_col_offset, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -9665,7 +9615,8 @@ obj2ast_arg(PyObject* obj, arg_ty* out, PyArena* arena)
}
int
-obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena)
+obj2ast_keyword(astmodulestate *state, PyObject* obj, keyword_ty* out, PyArena*
+ arena)
{
PyObject* tmp = NULL;
identifier arg;
@@ -9675,7 +9626,7 @@ obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena)
int end_lineno;
int end_col_offset;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->arg, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->arg, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -9684,11 +9635,11 @@ obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_identifier(tmp, &arg, arena);
+ res = obj2ast_identifier(state, tmp, &arg, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->value, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->value, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9697,11 +9648,11 @@ obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &value, arena);
+ res = obj2ast_expr(state, tmp, &value, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->lineno, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9710,12 +9661,11 @@ obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &lineno, arena);
+ res = obj2ast_int(state, tmp, &lineno, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->col_offset, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->col_offset, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9724,12 +9674,11 @@ obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &col_offset, arena);
+ res = obj2ast_int(state, tmp, &col_offset, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->end_lineno, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->end_lineno, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -9738,12 +9687,11 @@ obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &end_lineno, arena);
+ res = obj2ast_int(state, tmp, &end_lineno, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->end_col_offset, &tmp)
- < 0) {
+ if (_PyObject_LookupAttr(obj, state->end_col_offset, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -9752,7 +9700,7 @@ obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &end_col_offset, arena);
+ res = obj2ast_int(state, tmp, &end_col_offset, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -9765,13 +9713,14 @@ obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena)
}
int
-obj2ast_alias(PyObject* obj, alias_ty* out, PyArena* arena)
+obj2ast_alias(astmodulestate *state, PyObject* obj, alias_ty* out, PyArena*
+ arena)
{
PyObject* tmp = NULL;
identifier name;
identifier asname;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->name, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->name, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9780,11 +9729,11 @@ obj2ast_alias(PyObject* obj, alias_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_identifier(tmp, &name, arena);
+ res = obj2ast_identifier(state, tmp, &name, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->asname, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->asname, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -9793,7 +9742,7 @@ obj2ast_alias(PyObject* obj, alias_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_identifier(tmp, &asname, arena);
+ res = obj2ast_identifier(state, tmp, &asname, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -9805,14 +9754,14 @@ obj2ast_alias(PyObject* obj, alias_ty* out, PyArena* arena)
}
int
-obj2ast_withitem(PyObject* obj, withitem_ty* out, PyArena* arena)
+obj2ast_withitem(astmodulestate *state, PyObject* obj, withitem_ty* out,
+ PyArena* arena)
{
PyObject* tmp = NULL;
expr_ty context_expr;
expr_ty optional_vars;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->context_expr, &tmp) <
- 0) {
+ if (_PyObject_LookupAttr(obj, state->context_expr, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9821,12 +9770,11 @@ obj2ast_withitem(PyObject* obj, withitem_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &context_expr, arena);
+ res = obj2ast_expr(state, tmp, &context_expr, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->optional_vars, &tmp) <
- 0) {
+ if (_PyObject_LookupAttr(obj, state->optional_vars, &tmp) < 0) {
return 1;
}
if (tmp == NULL || tmp == Py_None) {
@@ -9835,7 +9783,7 @@ obj2ast_withitem(PyObject* obj, withitem_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_expr(tmp, &optional_vars, arena);
+ res = obj2ast_expr(state, tmp, &optional_vars, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -9847,7 +9795,8 @@ obj2ast_withitem(PyObject* obj, withitem_ty* out, PyArena* arena)
}
int
-obj2ast_type_ignore(PyObject* obj, type_ignore_ty* out, PyArena* arena)
+obj2ast_type_ignore(astmodulestate *state, PyObject* obj, type_ignore_ty* out,
+ PyArena* arena)
{
int isinstance;
@@ -9858,7 +9807,7 @@ obj2ast_type_ignore(PyObject* obj, type_ignore_ty* out, PyArena* arena)
*out = NULL;
return 0;
}
- tp = astmodulestate_global->TypeIgnore_type;
+ tp = state->TypeIgnore_type;
isinstance = PyObject_IsInstance(obj, tp);
if (isinstance == -1) {
return 1;
@@ -9867,8 +9816,7 @@ obj2ast_type_ignore(PyObject* obj, type_ignore_ty* out, PyArena* arena)
int lineno;
string tag;
- if (_PyObject_LookupAttr(obj, astmodulestate_global->lineno, &tmp) < 0)
- {
+ if (_PyObject_LookupAttr(obj, state->lineno, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9877,11 +9825,11 @@ obj2ast_type_ignore(PyObject* obj, type_ignore_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_int(tmp, &lineno, arena);
+ res = obj2ast_int(state, tmp, &lineno, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
- if (_PyObject_LookupAttr(obj, astmodulestate_global->tag, &tmp) < 0) {
+ if (_PyObject_LookupAttr(obj, state->tag, &tmp) < 0) {
return 1;
}
if (tmp == NULL) {
@@ -9890,7 +9838,7 @@ obj2ast_type_ignore(PyObject* obj, type_ignore_ty* out, PyArena* arena)
}
else {
int res;
- res = obj2ast_string(tmp, &tag, arena);
+ res = obj2ast_string(state, tmp, &tag, arena);
if (res != 0) goto failed;
Py_CLEAR(tmp);
}
@@ -9913,10 +9861,12 @@ PyInit__ast(void)
if (!init_types()) return NULL;
m = PyState_FindModule(&_astmodule);
if (!m) return NULL;
- if (PyModule_AddObject(m, "AST", astmodulestate_global->AST_type) < 0) {
+ astmodulestate *state = get_ast_state(m);
+
+ if (PyModule_AddObject(m, "AST", state->AST_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->AST_type);
+ Py_INCREF(state->AST_type);
if (PyModule_AddIntMacro(m, PyCF_ALLOW_TOP_LEVEL_AWAIT) < 0) {
goto error;
}
@@ -9926,485 +9876,432 @@ PyInit__ast(void)
if (PyModule_AddIntMacro(m, PyCF_TYPE_COMMENTS) < 0) {
goto error;
}
- if (PyModule_AddObject(m, "mod", astmodulestate_global->mod_type) < 0) {
+ if (PyModule_AddObject(m, "mod", state->mod_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->mod_type);
- if (PyModule_AddObject(m, "Module", astmodulestate_global->Module_type) <
- 0) {
+ Py_INCREF(state->mod_type);
+ if (PyModule_AddObject(m, "Module", state->Module_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Module_type);
- if (PyModule_AddObject(m, "Interactive",
- astmodulestate_global->Interactive_type) < 0) {
+ Py_INCREF(state->Module_type);
+ if (PyModule_AddObject(m, "Interactive", state->Interactive_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Interactive_type);
- if (PyModule_AddObject(m, "Expression",
- astmodulestate_global->Expression_type) < 0) {
+ Py_INCREF(state->Interactive_type);
+ if (PyModule_AddObject(m, "Expression", state->Expression_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Expression_type);
- if (PyModule_AddObject(m, "FunctionType",
- astmodulestate_global->FunctionType_type) < 0) {
+ Py_INCREF(state->Expression_type);
+ if (PyModule_AddObject(m, "FunctionType", state->FunctionType_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->FunctionType_type);
- if (PyModule_AddObject(m, "stmt", astmodulestate_global->stmt_type) < 0) {
+ Py_INCREF(state->FunctionType_type);
+ if (PyModule_AddObject(m, "stmt", state->stmt_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->stmt_type);
- if (PyModule_AddObject(m, "FunctionDef",
- astmodulestate_global->FunctionDef_type) < 0) {
+ Py_INCREF(state->stmt_type);
+ if (PyModule_AddObject(m, "FunctionDef", state->FunctionDef_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->FunctionDef_type);
- if (PyModule_AddObject(m, "AsyncFunctionDef",
- astmodulestate_global->AsyncFunctionDef_type) < 0) {
+ Py_INCREF(state->FunctionDef_type);
+ if (PyModule_AddObject(m, "AsyncFunctionDef", state->AsyncFunctionDef_type)
+ < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->AsyncFunctionDef_type);
- if (PyModule_AddObject(m, "ClassDef", astmodulestate_global->ClassDef_type)
- < 0) {
+ Py_INCREF(state->AsyncFunctionDef_type);
+ if (PyModule_AddObject(m, "ClassDef", state->ClassDef_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->ClassDef_type);
- if (PyModule_AddObject(m, "Return", astmodulestate_global->Return_type) <
- 0) {
+ Py_INCREF(state->ClassDef_type);
+ if (PyModule_AddObject(m, "Return", state->Return_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Return_type);
- if (PyModule_AddObject(m, "Delete", astmodulestate_global->Delete_type) <
- 0) {
+ Py_INCREF(state->Return_type);
+ if (PyModule_AddObject(m, "Delete", state->Delete_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Delete_type);
- if (PyModule_AddObject(m, "Assign", astmodulestate_global->Assign_type) <
- 0) {
+ Py_INCREF(state->Delete_type);
+ if (PyModule_AddObject(m, "Assign", state->Assign_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Assign_type);
- if (PyModule_AddObject(m, "AugAssign",
- astmodulestate_global->AugAssign_type) < 0) {
+ Py_INCREF(state->Assign_type);
+ if (PyModule_AddObject(m, "AugAssign", state->AugAssign_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->AugAssign_type);
- if (PyModule_AddObject(m, "AnnAssign",
- astmodulestate_global->AnnAssign_type) < 0) {
+ Py_INCREF(state->AugAssign_type);
+ if (PyModule_AddObject(m, "AnnAssign", state->AnnAssign_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->AnnAssign_type);
- if (PyModule_AddObject(m, "For", astmodulestate_global->For_type) < 0) {
+ Py_INCREF(state->AnnAssign_type);
+ if (PyModule_AddObject(m, "For", state->For_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->For_type);
- if (PyModule_AddObject(m, "AsyncFor", astmodulestate_global->AsyncFor_type)
- < 0) {
+ Py_INCREF(state->For_type);
+ if (PyModule_AddObject(m, "AsyncFor", state->AsyncFor_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->AsyncFor_type);
- if (PyModule_AddObject(m, "While", astmodulestate_global->While_type) < 0) {
+ Py_INCREF(state->AsyncFor_type);
+ if (PyModule_AddObject(m, "While", state->While_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->While_type);
- if (PyModule_AddObject(m, "If", astmodulestate_global->If_type) < 0) {
+ Py_INCREF(state->While_type);
+ if (PyModule_AddObject(m, "If", state->If_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->If_type);
- if (PyModule_AddObject(m, "With", astmodulestate_global->With_type) < 0) {
+ Py_INCREF(state->If_type);
+ if (PyModule_AddObject(m, "With", state->With_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->With_type);
- if (PyModule_AddObject(m, "AsyncWith",
- astmodulestate_global->AsyncWith_type) < 0) {
+ Py_INCREF(state->With_type);
+ if (PyModule_AddObject(m, "AsyncWith", state->AsyncWith_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->AsyncWith_type);
- if (PyModule_AddObject(m, "Raise", astmodulestate_global->Raise_type) < 0) {
+ Py_INCREF(state->AsyncWith_type);
+ if (PyModule_AddObject(m, "Raise", state->Raise_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Raise_type);
- if (PyModule_AddObject(m, "Try", astmodulestate_global->Try_type) < 0) {
+ Py_INCREF(state->Raise_type);
+ if (PyModule_AddObject(m, "Try", state->Try_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Try_type);
- if (PyModule_AddObject(m, "Assert", astmodulestate_global->Assert_type) <
- 0) {
+ Py_INCREF(state->Try_type);
+ if (PyModule_AddObject(m, "Assert", state->Assert_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Assert_type);
- if (PyModule_AddObject(m, "Import", astmodulestate_global->Import_type) <
- 0) {
+ Py_INCREF(state->Assert_type);
+ if (PyModule_AddObject(m, "Import", state->Import_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Import_type);
- if (PyModule_AddObject(m, "ImportFrom",
- astmodulestate_global->ImportFrom_type) < 0) {
+ Py_INCREF(state->Import_type);
+ if (PyModule_AddObject(m, "ImportFrom", state->ImportFrom_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->ImportFrom_type);
- if (PyModule_AddObject(m, "Global", astmodulestate_global->Global_type) <
- 0) {
+ Py_INCREF(state->ImportFrom_type);
+ if (PyModule_AddObject(m, "Global", state->Global_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Global_type);
- if (PyModule_AddObject(m, "Nonlocal", astmodulestate_global->Nonlocal_type)
- < 0) {
+ Py_INCREF(state->Global_type);
+ if (PyModule_AddObject(m, "Nonlocal", state->Nonlocal_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Nonlocal_type);
- if (PyModule_AddObject(m, "Expr", astmodulestate_global->Expr_type) < 0) {
+ Py_INCREF(state->Nonlocal_type);
+ if (PyModule_AddObject(m, "Expr", state->Expr_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Expr_type);
- if (PyModule_AddObject(m, "Pass", astmodulestate_global->Pass_type) < 0) {
+ Py_INCREF(state->Expr_type);
+ if (PyModule_AddObject(m, "Pass", state->Pass_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Pass_type);
- if (PyModule_AddObject(m, "Break", astmodulestate_global->Break_type) < 0) {
+ Py_INCREF(state->Pass_type);
+ if (PyModule_AddObject(m, "Break", state->Break_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Break_type);
- if (PyModule_AddObject(m, "Continue", astmodulestate_global->Continue_type)
- < 0) {
+ Py_INCREF(state->Break_type);
+ if (PyModule_AddObject(m, "Continue", state->Continue_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Continue_type);
- if (PyModule_AddObject(m, "expr", astmodulestate_global->expr_type) < 0) {
+ Py_INCREF(state->Continue_type);
+ if (PyModule_AddObject(m, "expr", state->expr_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->expr_type);
- if (PyModule_AddObject(m, "BoolOp", astmodulestate_global->BoolOp_type) <
- 0) {
+ Py_INCREF(state->expr_type);
+ if (PyModule_AddObject(m, "BoolOp", state->BoolOp_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->BoolOp_type);
- if (PyModule_AddObject(m, "NamedExpr",
- astmodulestate_global->NamedExpr_type) < 0) {
+ Py_INCREF(state->BoolOp_type);
+ if (PyModule_AddObject(m, "NamedExpr", state->NamedExpr_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->NamedExpr_type);
- if (PyModule_AddObject(m, "BinOp", astmodulestate_global->BinOp_type) < 0) {
+ Py_INCREF(state->NamedExpr_type);
+ if (PyModule_AddObject(m, "BinOp", state->BinOp_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->BinOp_type);
- if (PyModule_AddObject(m, "UnaryOp", astmodulestate_global->UnaryOp_type) <
- 0) {
+ Py_INCREF(state->BinOp_type);
+ if (PyModule_AddObject(m, "UnaryOp", state->UnaryOp_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->UnaryOp_type);
- if (PyModule_AddObject(m, "Lambda", astmodulestate_global->Lambda_type) <
- 0) {
+ Py_INCREF(state->UnaryOp_type);
+ if (PyModule_AddObject(m, "Lambda", state->Lambda_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Lambda_type);
- if (PyModule_AddObject(m, "IfExp", astmodulestate_global->IfExp_type) < 0) {
+ Py_INCREF(state->Lambda_type);
+ if (PyModule_AddObject(m, "IfExp", state->IfExp_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->IfExp_type);
- if (PyModule_AddObject(m, "Dict", astmodulestate_global->Dict_type) < 0) {
+ Py_INCREF(state->IfExp_type);
+ if (PyModule_AddObject(m, "Dict", state->Dict_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Dict_type);
- if (PyModule_AddObject(m, "Set", astmodulestate_global->Set_type) < 0) {
+ Py_INCREF(state->Dict_type);
+ if (PyModule_AddObject(m, "Set", state->Set_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Set_type);
- if (PyModule_AddObject(m, "ListComp", astmodulestate_global->ListComp_type)
- < 0) {
+ Py_INCREF(state->Set_type);
+ if (PyModule_AddObject(m, "ListComp", state->ListComp_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->ListComp_type);
- if (PyModule_AddObject(m, "SetComp", astmodulestate_global->SetComp_type) <
- 0) {
+ Py_INCREF(state->ListComp_type);
+ if (PyModule_AddObject(m, "SetComp", state->SetComp_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->SetComp_type);
- if (PyModule_AddObject(m, "DictComp", astmodulestate_global->DictComp_type)
- < 0) {
+ Py_INCREF(state->SetComp_type);
+ if (PyModule_AddObject(m, "DictComp", state->DictComp_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->DictComp_type);
- if (PyModule_AddObject(m, "GeneratorExp",
- astmodulestate_global->GeneratorExp_type) < 0) {
+ Py_INCREF(state->DictComp_type);
+ if (PyModule_AddObject(m, "GeneratorExp", state->GeneratorExp_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->GeneratorExp_type);
- if (PyModule_AddObject(m, "Await", astmodulestate_global->Await_type) < 0) {
+ Py_INCREF(state->GeneratorExp_type);
+ if (PyModule_AddObject(m, "Await", state->Await_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Await_type);
- if (PyModule_AddObject(m, "Yield", astmodulestate_global->Yield_type) < 0) {
+ Py_INCREF(state->Await_type);
+ if (PyModule_AddObject(m, "Yield", state->Yield_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Yield_type);
- if (PyModule_AddObject(m, "YieldFrom",
- astmodulestate_global->YieldFrom_type) < 0) {
+ Py_INCREF(state->Yield_type);
+ if (PyModule_AddObject(m, "YieldFrom", state->YieldFrom_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->YieldFrom_type);
- if (PyModule_AddObject(m, "Compare", astmodulestate_global->Compare_type) <
- 0) {
+ Py_INCREF(state->YieldFrom_type);
+ if (PyModule_AddObject(m, "Compare", state->Compare_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Compare_type);
- if (PyModule_AddObject(m, "Call", astmodulestate_global->Call_type) < 0) {
+ Py_INCREF(state->Compare_type);
+ if (PyModule_AddObject(m, "Call", state->Call_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Call_type);
- if (PyModule_AddObject(m, "FormattedValue",
- astmodulestate_global->FormattedValue_type) < 0) {
+ Py_INCREF(state->Call_type);
+ if (PyModule_AddObject(m, "FormattedValue", state->FormattedValue_type) <
+ 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->FormattedValue_type);
- if (PyModule_AddObject(m, "JoinedStr",
- astmodulestate_global->JoinedStr_type) < 0) {
+ Py_INCREF(state->FormattedValue_type);
+ if (PyModule_AddObject(m, "JoinedStr", state->JoinedStr_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->JoinedStr_type);
- if (PyModule_AddObject(m, "Constant", astmodulestate_global->Constant_type)
- < 0) {
+ Py_INCREF(state->JoinedStr_type);
+ if (PyModule_AddObject(m, "Constant", state->Constant_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Constant_type);
- if (PyModule_AddObject(m, "Attribute",
- astmodulestate_global->Attribute_type) < 0) {
+ Py_INCREF(state->Constant_type);
+ if (PyModule_AddObject(m, "Attribute", state->Attribute_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Attribute_type);
- if (PyModule_AddObject(m, "Subscript",
- astmodulestate_global->Subscript_type) < 0) {
+ Py_INCREF(state->Attribute_type);
+ if (PyModule_AddObject(m, "Subscript", state->Subscript_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Subscript_type);
- if (PyModule_AddObject(m, "Starred", astmodulestate_global->Starred_type) <
- 0) {
+ Py_INCREF(state->Subscript_type);
+ if (PyModule_AddObject(m, "Starred", state->Starred_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Starred_type);
- if (PyModule_AddObject(m, "Name", astmodulestate_global->Name_type) < 0) {
+ Py_INCREF(state->Starred_type);
+ if (PyModule_AddObject(m, "Name", state->Name_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Name_type);
- if (PyModule_AddObject(m, "List", astmodulestate_global->List_type) < 0) {
+ Py_INCREF(state->Name_type);
+ if (PyModule_AddObject(m, "List", state->List_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->List_type);
- if (PyModule_AddObject(m, "Tuple", astmodulestate_global->Tuple_type) < 0) {
+ Py_INCREF(state->List_type);
+ if (PyModule_AddObject(m, "Tuple", state->Tuple_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Tuple_type);
- if (PyModule_AddObject(m, "Slice", astmodulestate_global->Slice_type) < 0) {
+ Py_INCREF(state->Tuple_type);
+ if (PyModule_AddObject(m, "Slice", state->Slice_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Slice_type);
- if (PyModule_AddObject(m, "expr_context",
- astmodulestate_global->expr_context_type) < 0) {
+ Py_INCREF(state->Slice_type);
+ if (PyModule_AddObject(m, "expr_context", state->expr_context_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->expr_context_type);
- if (PyModule_AddObject(m, "Load", astmodulestate_global->Load_type) < 0) {
+ Py_INCREF(state->expr_context_type);
+ if (PyModule_AddObject(m, "Load", state->Load_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Load_type);
- if (PyModule_AddObject(m, "Store", astmodulestate_global->Store_type) < 0) {
+ Py_INCREF(state->Load_type);
+ if (PyModule_AddObject(m, "Store", state->Store_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Store_type);
- if (PyModule_AddObject(m, "Del", astmodulestate_global->Del_type) < 0) {
+ Py_INCREF(state->Store_type);
+ if (PyModule_AddObject(m, "Del", state->Del_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Del_type);
- if (PyModule_AddObject(m, "boolop", astmodulestate_global->boolop_type) <
- 0) {
+ Py_INCREF(state->Del_type);
+ if (PyModule_AddObject(m, "boolop", state->boolop_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->boolop_type);
- if (PyModule_AddObject(m, "And", astmodulestate_global->And_type) < 0) {
+ Py_INCREF(state->boolop_type);
+ if (PyModule_AddObject(m, "And", state->And_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->And_type);
- if (PyModule_AddObject(m, "Or", astmodulestate_global->Or_type) < 0) {
+ Py_INCREF(state->And_type);
+ if (PyModule_AddObject(m, "Or", state->Or_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Or_type);
- if (PyModule_AddObject(m, "operator", astmodulestate_global->operator_type)
- < 0) {
+ Py_INCREF(state->Or_type);
+ if (PyModule_AddObject(m, "operator", state->operator_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->operator_type);
- if (PyModule_AddObject(m, "Add", astmodulestate_global->Add_type) < 0) {
+ Py_INCREF(state->operator_type);
+ if (PyModule_AddObject(m, "Add", state->Add_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Add_type);
- if (PyModule_AddObject(m, "Sub", astmodulestate_global->Sub_type) < 0) {
+ Py_INCREF(state->Add_type);
+ if (PyModule_AddObject(m, "Sub", state->Sub_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Sub_type);
- if (PyModule_AddObject(m, "Mult", astmodulestate_global->Mult_type) < 0) {
+ Py_INCREF(state->Sub_type);
+ if (PyModule_AddObject(m, "Mult", state->Mult_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Mult_type);
- if (PyModule_AddObject(m, "MatMult", astmodulestate_global->MatMult_type) <
- 0) {
+ Py_INCREF(state->Mult_type);
+ if (PyModule_AddObject(m, "MatMult", state->MatMult_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->MatMult_type);
- if (PyModule_AddObject(m, "Div", astmodulestate_global->Div_type) < 0) {
+ Py_INCREF(state->MatMult_type);
+ if (PyModule_AddObject(m, "Div", state->Div_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Div_type);
- if (PyModule_AddObject(m, "Mod", astmodulestate_global->Mod_type) < 0) {
+ Py_INCREF(state->Div_type);
+ if (PyModule_AddObject(m, "Mod", state->Mod_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Mod_type);
- if (PyModule_AddObject(m, "Pow", astmodulestate_global->Pow_type) < 0) {
+ Py_INCREF(state->Mod_type);
+ if (PyModule_AddObject(m, "Pow", state->Pow_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Pow_type);
- if (PyModule_AddObject(m, "LShift", astmodulestate_global->LShift_type) <
- 0) {
+ Py_INCREF(state->Pow_type);
+ if (PyModule_AddObject(m, "LShift", state->LShift_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->LShift_type);
- if (PyModule_AddObject(m, "RShift", astmodulestate_global->RShift_type) <
- 0) {
+ Py_INCREF(state->LShift_type);
+ if (PyModule_AddObject(m, "RShift", state->RShift_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->RShift_type);
- if (PyModule_AddObject(m, "BitOr", astmodulestate_global->BitOr_type) < 0) {
+ Py_INCREF(state->RShift_type);
+ if (PyModule_AddObject(m, "BitOr", state->BitOr_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->BitOr_type);
- if (PyModule_AddObject(m, "BitXor", astmodulestate_global->BitXor_type) <
- 0) {
+ Py_INCREF(state->BitOr_type);
+ if (PyModule_AddObject(m, "BitXor", state->BitXor_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->BitXor_type);
- if (PyModule_AddObject(m, "BitAnd", astmodulestate_global->BitAnd_type) <
- 0) {
+ Py_INCREF(state->BitXor_type);
+ if (PyModule_AddObject(m, "BitAnd", state->BitAnd_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->BitAnd_type);
- if (PyModule_AddObject(m, "FloorDiv", astmodulestate_global->FloorDiv_type)
- < 0) {
+ Py_INCREF(state->BitAnd_type);
+ if (PyModule_AddObject(m, "FloorDiv", state->FloorDiv_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->FloorDiv_type);
- if (PyModule_AddObject(m, "unaryop", astmodulestate_global->unaryop_type) <
- 0) {
+ Py_INCREF(state->FloorDiv_type);
+ if (PyModule_AddObject(m, "unaryop", state->unaryop_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->unaryop_type);
- if (PyModule_AddObject(m, "Invert", astmodulestate_global->Invert_type) <
- 0) {
+ Py_INCREF(state->unaryop_type);
+ if (PyModule_AddObject(m, "Invert", state->Invert_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Invert_type);
- if (PyModule_AddObject(m, "Not", astmodulestate_global->Not_type) < 0) {
+ Py_INCREF(state->Invert_type);
+ if (PyModule_AddObject(m, "Not", state->Not_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Not_type);
- if (PyModule_AddObject(m, "UAdd", astmodulestate_global->UAdd_type) < 0) {
+ Py_INCREF(state->Not_type);
+ if (PyModule_AddObject(m, "UAdd", state->UAdd_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->UAdd_type);
- if (PyModule_AddObject(m, "USub", astmodulestate_global->USub_type) < 0) {
+ Py_INCREF(state->UAdd_type);
+ if (PyModule_AddObject(m, "USub", state->USub_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->USub_type);
- if (PyModule_AddObject(m, "cmpop", astmodulestate_global->cmpop_type) < 0) {
+ Py_INCREF(state->USub_type);
+ if (PyModule_AddObject(m, "cmpop", state->cmpop_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->cmpop_type);
- if (PyModule_AddObject(m, "Eq", astmodulestate_global->Eq_type) < 0) {
+ Py_INCREF(state->cmpop_type);
+ if (PyModule_AddObject(m, "Eq", state->Eq_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Eq_type);
- if (PyModule_AddObject(m, "NotEq", astmodulestate_global->NotEq_type) < 0) {
+ Py_INCREF(state->Eq_type);
+ if (PyModule_AddObject(m, "NotEq", state->NotEq_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->NotEq_type);
- if (PyModule_AddObject(m, "Lt", astmodulestate_global->Lt_type) < 0) {
+ Py_INCREF(state->NotEq_type);
+ if (PyModule_AddObject(m, "Lt", state->Lt_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Lt_type);
- if (PyModule_AddObject(m, "LtE", astmodulestate_global->LtE_type) < 0) {
+ Py_INCREF(state->Lt_type);
+ if (PyModule_AddObject(m, "LtE", state->LtE_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->LtE_type);
- if (PyModule_AddObject(m, "Gt", astmodulestate_global->Gt_type) < 0) {
+ Py_INCREF(state->LtE_type);
+ if (PyModule_AddObject(m, "Gt", state->Gt_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Gt_type);
- if (PyModule_AddObject(m, "GtE", astmodulestate_global->GtE_type) < 0) {
+ Py_INCREF(state->Gt_type);
+ if (PyModule_AddObject(m, "GtE", state->GtE_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->GtE_type);
- if (PyModule_AddObject(m, "Is", astmodulestate_global->Is_type) < 0) {
+ Py_INCREF(state->GtE_type);
+ if (PyModule_AddObject(m, "Is", state->Is_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->Is_type);
- if (PyModule_AddObject(m, "IsNot", astmodulestate_global->IsNot_type) < 0) {
+ Py_INCREF(state->Is_type);
+ if (PyModule_AddObject(m, "IsNot", state->IsNot_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->IsNot_type);
- if (PyModule_AddObject(m, "In", astmodulestate_global->In_type) < 0) {
+ Py_INCREF(state->IsNot_type);
+ if (PyModule_AddObject(m, "In", state->In_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->In_type);
- if (PyModule_AddObject(m, "NotIn", astmodulestate_global->NotIn_type) < 0) {
+ Py_INCREF(state->In_type);
+ if (PyModule_AddObject(m, "NotIn", state->NotIn_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->NotIn_type);
- if (PyModule_AddObject(m, "comprehension",
- astmodulestate_global->comprehension_type) < 0) {
+ Py_INCREF(state->NotIn_type);
+ if (PyModule_AddObject(m, "comprehension", state->comprehension_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->comprehension_type);
- if (PyModule_AddObject(m, "excepthandler",
- astmodulestate_global->excepthandler_type) < 0) {
+ Py_INCREF(state->comprehension_type);
+ if (PyModule_AddObject(m, "excepthandler", state->excepthandler_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->excepthandler_type);
- if (PyModule_AddObject(m, "ExceptHandler",
- astmodulestate_global->ExceptHandler_type) < 0) {
+ Py_INCREF(state->excepthandler_type);
+ if (PyModule_AddObject(m, "ExceptHandler", state->ExceptHandler_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->ExceptHandler_type);
- if (PyModule_AddObject(m, "arguments",
- astmodulestate_global->arguments_type) < 0) {
+ Py_INCREF(state->ExceptHandler_type);
+ if (PyModule_AddObject(m, "arguments", state->arguments_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->arguments_type);
- if (PyModule_AddObject(m, "arg", astmodulestate_global->arg_type) < 0) {
+ Py_INCREF(state->arguments_type);
+ if (PyModule_AddObject(m, "arg", state->arg_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->arg_type);
- if (PyModule_AddObject(m, "keyword", astmodulestate_global->keyword_type) <
- 0) {
+ Py_INCREF(state->arg_type);
+ if (PyModule_AddObject(m, "keyword", state->keyword_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->keyword_type);
- if (PyModule_AddObject(m, "alias", astmodulestate_global->alias_type) < 0) {
+ Py_INCREF(state->keyword_type);
+ if (PyModule_AddObject(m, "alias", state->alias_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->alias_type);
- if (PyModule_AddObject(m, "withitem", astmodulestate_global->withitem_type)
- < 0) {
+ Py_INCREF(state->alias_type);
+ if (PyModule_AddObject(m, "withitem", state->withitem_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->withitem_type);
- if (PyModule_AddObject(m, "type_ignore",
- astmodulestate_global->type_ignore_type) < 0) {
+ Py_INCREF(state->withitem_type);
+ if (PyModule_AddObject(m, "type_ignore", state->type_ignore_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->type_ignore_type);
- if (PyModule_AddObject(m, "TypeIgnore",
- astmodulestate_global->TypeIgnore_type) < 0) {
+ Py_INCREF(state->type_ignore_type);
+ if (PyModule_AddObject(m, "TypeIgnore", state->TypeIgnore_type) < 0) {
goto error;
}
- Py_INCREF(astmodulestate(m)->TypeIgnore_type);
+ Py_INCREF(state->TypeIgnore_type);
return m;
error:
Py_DECREF(m);
@@ -10416,13 +10313,13 @@ PyObject* PyAST_mod2obj(mod_ty t)
{
if (!init_types())
return NULL;
- return ast2obj_mod(t);
+ astmodulestate *state = astmodulestate_global;
+ return ast2obj_mod(state, t);
}
/* mode is 0 for "exec", 1 for "eval" and 2 for "single" input */
mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
{
- PyObject *req_type[3];
const char * const req_name[] = {"Module", "Expression", "Interactive"};
int isinstance;
@@ -10430,9 +10327,11 @@ mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
return NULL;
}
- req_type[0] = astmodulestate_global->Module_type;
- req_type[1] = astmodulestate_global->Expression_type;
- req_type[2] = astmodulestate_global->Interactive_type;
+ astmodulestate *state = astmodulestate_global;
+ PyObject *req_type[3];
+ req_type[0] = state->Module_type;
+ req_type[1] = state->Expression_type;
+ req_type[2] = state->Interactive_type;
assert(0 <= mode && mode <= 2);
@@ -10449,7 +10348,7 @@ mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode)
}
mod_ty res = NULL;
- if (obj2ast_mod(ast, &res, arena) != 0)
+ if (obj2ast_mod(state, ast, &res, arena) != 0)
return NULL;
else
return res;
@@ -10459,7 +10358,8 @@ int PyAST_Check(PyObject* obj)
{
if (!init_types())
return -1;
- return PyObject_IsInstance(obj, astmodulestate_global->AST_type);
+ astmodulestate *state = astmodulestate_global;
+ return PyObject_IsInstance(obj, state->AST_type);
}
1
0
bpo-1635741: Port sha256 module to multiphase init (PEP 489) (GH-21189)
by Mohamed Koubaa July 3, 2020
by Mohamed Koubaa July 3, 2020
July 3, 2020
https://github.com/python/cpython/commit/9d006977d7ff5a45d6e7d696c1713fdf2d…
commit: 9d006977d7ff5a45d6e7d696c1713fdf2dd308b7
branch: master
author: Mohamed Koubaa <koubaa.m(a)gmail.com>
committer: GitHub <noreply(a)github.com>
date: 2020-07-03T17:59:47+09:00
summary:
bpo-1635741: Port sha256 module to multiphase init (PEP 489) (GH-21189)
files:
A Misc/NEWS.d/next/Core and Builtins/2020-07-01-20-17-38.bpo-1635741.-AtPYu.rst
M Modules/sha256module.c
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-07-01-20-17-38.bpo-1635741.-AtPYu.rst b/Misc/NEWS.d/next/Core and Builtins/2020-07-01-20-17-38.bpo-1635741.-AtPYu.rst
new file mode 100644
index 0000000000000..c529923779fa8
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2020-07-01-20-17-38.bpo-1635741.-AtPYu.rst
@@ -0,0 +1 @@
+Port :mod:`sha256` to multiphase initialization
diff --git a/Modules/sha256module.c b/Modules/sha256module.c
index 261f9daee2807..06e4430bd7c33 100644
--- a/Modules/sha256module.c
+++ b/Modules/sha256module.c
@@ -681,43 +681,45 @@ static struct PyMethodDef SHA_functions[] = {
{NULL, NULL} /* Sentinel */
};
-
-/* Initialize this module. */
-
-static struct PyModuleDef _sha256module = {
- PyModuleDef_HEAD_INIT,
- "_sha256",
- NULL,
- -1,
- SHA_functions,
- NULL,
- NULL,
- NULL,
- NULL
-};
-
-PyMODINIT_FUNC
-PyInit__sha256(void)
+static int sha256_exec(PyObject *module)
{
- PyObject *m;
-
Py_SET_TYPE(&SHA224type, &PyType_Type);
if (PyType_Ready(&SHA224type) < 0) {
- return NULL;
+ return -1;
}
Py_SET_TYPE(&SHA256type, &PyType_Type);
if (PyType_Ready(&SHA256type) < 0) {
- return NULL;
+ return -1;
}
- m = PyModule_Create(&_sha256module);
- if (m == NULL)
- return NULL;
-
Py_INCREF((PyObject *)&SHA224type);
- PyModule_AddObject(m, "SHA224Type", (PyObject *)&SHA224type);
+ if (PyModule_AddObject(module, "SHA224Type", (PyObject *)&SHA224type) < 0) {
+ Py_DECREF((PyObject *)&SHA224type);
+ return -1;
+ }
Py_INCREF((PyObject *)&SHA256type);
- PyModule_AddObject(m, "SHA256Type", (PyObject *)&SHA256type);
- return m;
+ if (PyModule_AddObject(module, "SHA256Type", (PyObject *)&SHA256type) < 0) {
+ Py_DECREF((PyObject *)&SHA256type);
+ return -1;
+ }
+ return 0;
+}
+
+static PyModuleDef_Slot _sha256_slots[] = {
+ {Py_mod_exec, sha256_exec},
+ {0, NULL}
+};
+
+static struct PyModuleDef _sha256module = {
+ PyModuleDef_HEAD_INIT,
+ .m_name = "_sha256",
+ .m_methods = SHA_functions,
+ .m_slots = _sha256_slots,
+};
+/* Initialize this module. */
+PyMODINIT_FUNC
+PyInit__sha256(void)
+{
+ return PyModuleDef_Init(&_sha256module);
}
1
0
bpo-39960: Allow heap types in the "Carlo Verre" hack check that override "tp_setattro()" (GH-21092)
by scoder July 3, 2020
by scoder July 3, 2020
July 3, 2020
https://github.com/python/cpython/commit/148f32913573c29250dfb3f0d079eb8847…
commit: 148f32913573c29250dfb3f0d079eb8847633621
branch: master
author: scoder <stefan_ml(a)behnel.de>
committer: GitHub <noreply(a)github.com>
date: 2020-07-02T17:09:28-07:00
summary:
bpo-39960: Allow heap types in the "Carlo Verre" hack check that override "tp_setattro()" (GH-21092)
Automerge-Triggered-By: @gvanrossum
files:
A Misc/NEWS.d/next/Core and Builtins/2020-06-23-18-32-41.bpo-39960.Kez3fP.rst
M Lib/test/test_capi.py
M Modules/_testcapimodule.c
M Objects/typeobject.c
diff --git a/Lib/test/test_capi.py b/Lib/test/test_capi.py
index fa5ca1c97f458..3e7afd5a2a1e4 100644
--- a/Lib/test/test_capi.py
+++ b/Lib/test/test_capi.py
@@ -516,6 +516,14 @@ def test_c_subclass_of_heap_ctype_with_del_modifying_dunder_class_only_decrefs_o
# Test that subtype_dealloc decref the newly assigned __class__ only once
self.assertEqual(new_type_refcnt, sys.getrefcount(_testcapi.HeapCTypeSubclass))
+ def test_heaptype_with_setattro(self):
+ obj = _testcapi.HeapCTypeSetattr()
+ self.assertEqual(obj.pvalue, 10)
+ obj.value = 12
+ self.assertEqual(obj.pvalue, 12)
+ del obj.value
+ self.assertEqual(obj.pvalue, 0)
+
def test_pynumber_tobase(self):
from _testcapi import pynumber_tobase
self.assertEqual(pynumber_tobase(123, 2), '0b1111011')
diff --git a/Misc/NEWS.d/next/Core and Builtins/2020-06-23-18-32-41.bpo-39960.Kez3fP.rst b/Misc/NEWS.d/next/Core and Builtins/2020-06-23-18-32-41.bpo-39960.Kez3fP.rst
new file mode 100644
index 0000000000000..f69fccfa4db69
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2020-06-23-18-32-41.bpo-39960.Kez3fP.rst
@@ -0,0 +1,2 @@
+The "hackcheck" that prevents sneaking around a type's __setattr__() by calling the
+superclass method was rewritten to allow C implemented heap types.
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index aafbc392a4846..629102b12a9fe 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -6528,6 +6528,80 @@ static PyType_Spec HeapCTypeWithWeakref_spec = {
HeapCTypeWithWeakref_slots
};
+PyDoc_STRVAR(heapctypesetattr__doc__,
+"A heap type without GC, but with overridden __setattr__.\n\n"
+"The 'value' attribute is set to 10 in __init__ and updated via attribute setting.");
+
+typedef struct {
+ PyObject_HEAD
+ long value;
+} HeapCTypeSetattrObject;
+
+static struct PyMemberDef heapctypesetattr_members[] = {
+ {"pvalue", T_LONG, offsetof(HeapCTypeSetattrObject, value)},
+ {NULL} /* Sentinel */
+};
+
+static int
+heapctypesetattr_init(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+ ((HeapCTypeSetattrObject *)self)->value = 10;
+ return 0;
+}
+
+static void
+heapctypesetattr_dealloc(HeapCTypeSetattrObject *self)
+{
+ PyTypeObject *tp = Py_TYPE(self);
+ PyObject_Del(self);
+ Py_DECREF(tp);
+}
+
+static int
+heapctypesetattr_setattro(HeapCTypeSetattrObject *self, PyObject *attr, PyObject *value)
+{
+ PyObject *svalue = PyUnicode_FromString("value");
+ if (svalue == NULL)
+ return -1;
+ int eq = PyObject_RichCompareBool(svalue, attr, Py_EQ);
+ Py_DECREF(svalue);
+ if (eq < 0)
+ return -1;
+ if (!eq) {
+ return PyObject_GenericSetAttr((PyObject*) self, attr, value);
+ }
+ if (value == NULL) {
+ self->value = 0;
+ return 0;
+ }
+ PyObject *ivalue = PyNumber_Long(value);
+ if (ivalue == NULL)
+ return -1;
+ long v = PyLong_AsLong(ivalue);
+ Py_DECREF(ivalue);
+ if (v == -1 && PyErr_Occurred())
+ return -1;
+ self->value = v;
+ return 0;
+}
+
+static PyType_Slot HeapCTypeSetattr_slots[] = {
+ {Py_tp_init, heapctypesetattr_init},
+ {Py_tp_members, heapctypesetattr_members},
+ {Py_tp_setattro, heapctypesetattr_setattro},
+ {Py_tp_dealloc, heapctypesetattr_dealloc},
+ {Py_tp_doc, (char*)heapctypesetattr__doc__},
+ {0, 0},
+};
+
+static PyType_Spec HeapCTypeSetattr_spec = {
+ "_testcapi.HeapCTypeSetattr",
+ sizeof(HeapCTypeSetattrObject),
+ 0,
+ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE,
+ HeapCTypeSetattr_slots
+};
+
static PyMethodDef meth_instance_methods[] = {
{"meth_varargs", meth_varargs, METH_VARARGS},
{"meth_varargs_keywords", (PyCFunction)(void(*)(void))meth_varargs_keywords, METH_VARARGS|METH_KEYWORDS},
@@ -6834,6 +6908,12 @@ PyInit__testcapi(void)
}
PyModule_AddObject(m, "HeapCTypeWithBuffer", HeapCTypeWithBuffer);
+ PyObject *HeapCTypeSetattr = PyType_FromSpec(&HeapCTypeSetattr_spec);
+ if (HeapCTypeSetattr == NULL) {
+ return NULL;
+ }
+ PyModule_AddObject(m, "HeapCTypeSetattr", HeapCTypeSetattr);
+
PyObject *subclass_with_finalizer_bases = PyTuple_Pack(1, HeapCTypeSubclass);
if (subclass_with_finalizer_bases == NULL) {
return NULL;
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index f0e349ecd2bb9..16f95f0e1bf7f 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -97,6 +97,9 @@ clear_slotdefs(void);
static PyObject *
lookup_maybe_method(PyObject *self, _Py_Identifier *attrid, int *unbound);
+static int
+slot_tp_setattro(PyObject *self, PyObject *name, PyObject *value);
+
/*
* finds the beginning of the docstring's introspection signature.
* if present, returns a pointer pointing to the first '('.
@@ -5945,22 +5948,38 @@ wrap_delitem(PyObject *self, PyObject *args, void *wrapped)
}
/* Helper to check for object.__setattr__ or __delattr__ applied to a type.
- This is called the Carlo Verre hack after its discoverer. */
+ This is called the Carlo Verre hack after its discoverer. See
+ https://mail.python.org/pipermail/python-dev/2003-April/034535.html
+ */
static int
hackcheck(PyObject *self, setattrofunc func, const char *what)
{
PyTypeObject *type = Py_TYPE(self);
- while (type && type->tp_flags & Py_TPFLAGS_HEAPTYPE)
- type = type->tp_base;
- /* If type is NULL now, this is a really weird type.
- In the spirit of backwards compatibility (?), just shut up. */
- if (type && type->tp_setattro != func) {
- PyErr_Format(PyExc_TypeError,
- "can't apply this %s to %s object",
- what,
- type->tp_name);
- return 0;
+ PyObject *mro = type->tp_mro;
+ if (!mro) {
+ /* Probably ok not to check the call in this case. */
+ return 1;
+ }
+ assert(PyTuple_Check(mro));
+ Py_ssize_t i, n;
+ n = PyTuple_GET_SIZE(mro);
+ for (i = 0; i < n; i++) {
+ PyTypeObject *base = (PyTypeObject*) PyTuple_GET_ITEM(mro, i);
+ if (base->tp_setattro == func) {
+ /* 'func' is the earliest non-Python implementation in the MRO. */
+ break;
+ } else if (base->tp_setattro != slot_tp_setattro) {
+ /* 'base' is not a Python class and overrides 'func'.
+ Its tp_setattro should be called instead. */
+ PyErr_Format(PyExc_TypeError,
+ "can't apply this %s to %s object",
+ what,
+ type->tp_name);
+ return 0;
+ }
}
+ /* Either 'func' is not in the mro (which should fail when checking 'self'),
+ or it's the right slot function to call. */
return 1;
}
1
0
https://github.com/python/cpython/commit/67673b08ea302174ca9c6559c04311550a…
commit: 67673b08ea302174ca9c6559c04311550ae9f189
branch: master
author: Pablo Galindo <Pablogsal(a)gmail.com>
committer: GitHub <noreply(a)github.com>
date: 2020-07-02T23:08:36+01:00
summary:
Remove extraneous file from the Docs folder (GH-21286)
files:
D Doc/myfile.bz2
diff --git a/Doc/myfile.bz2 b/Doc/myfile.bz2
deleted file mode 100644
index 7ada20f60926b..0000000000000
Binary files a/Doc/myfile.bz2 and /dev/null differ
1
0
July 2, 2020
https://github.com/python/cpython/commit/f52bf62fe12d46267e958f80dbe1f4425b…
commit: f52bf62fe12d46267e958f80dbe1f4425b55cd0f
branch: 3.5
author: Christian Heimes <christian(a)python.org>
committer: GitHub <noreply(a)github.com>
date: 2020-07-02T05:32:05-07:00
summary:
bpo-41183: Update finite DH params to 3072 bits (#21278)
Signed-off-by: Christian Heimes <christian(a)python.org>
files:
A Lib/test/ffdh3072.pem
D Lib/test/dh1024.pem
M Lib/test/test_ssl.py
diff --git a/Lib/test/dh1024.pem b/Lib/test/dh1024.pem
deleted file mode 100644
index a391176b5fea3..0000000000000
--- a/Lib/test/dh1024.pem
+++ /dev/null
@@ -1,7 +0,0 @@
------BEGIN DH PARAMETERS-----
-MIGHAoGBAIbzw1s9CT8SV5yv6L7esdAdZYZjPi3qWFs61CYTFFQnf2s/d09NYaJt
-rrvJhIzWavqnue71qXCf83/J3nz3FEwUU/L0mGyheVbsSHiI64wUo3u50wK5Igo0
-RNs/LD0irs7m0icZ//hijafTU+JOBiuA8zMI+oZfU7BGuc9XrUprAgEC
------END DH PARAMETERS-----
-
-Generated with: openssl dhparam -out dh1024.pem 1024
diff --git a/Lib/test/ffdh3072.pem b/Lib/test/ffdh3072.pem
new file mode 100644
index 0000000000000..ad69bac8d00c7
--- /dev/null
+++ b/Lib/test/ffdh3072.pem
@@ -0,0 +1,41 @@
+ DH Parameters: (3072 bit)
+ prime:
+ 00:ff:ff:ff:ff:ff:ff:ff:ff:ad:f8:54:58:a2:bb:
+ 4a:9a:af:dc:56:20:27:3d:3c:f1:d8:b9:c5:83:ce:
+ 2d:36:95:a9:e1:36:41:14:64:33:fb:cc:93:9d:ce:
+ 24:9b:3e:f9:7d:2f:e3:63:63:0c:75:d8:f6:81:b2:
+ 02:ae:c4:61:7a:d3:df:1e:d5:d5:fd:65:61:24:33:
+ f5:1f:5f:06:6e:d0:85:63:65:55:3d:ed:1a:f3:b5:
+ 57:13:5e:7f:57:c9:35:98:4f:0c:70:e0:e6:8b:77:
+ e2:a6:89:da:f3:ef:e8:72:1d:f1:58:a1:36:ad:e7:
+ 35:30:ac:ca:4f:48:3a:79:7a:bc:0a:b1:82:b3:24:
+ fb:61:d1:08:a9:4b:b2:c8:e3:fb:b9:6a:da:b7:60:
+ d7:f4:68:1d:4f:42:a3:de:39:4d:f4:ae:56:ed:e7:
+ 63:72:bb:19:0b:07:a7:c8:ee:0a:6d:70:9e:02:fc:
+ e1:cd:f7:e2:ec:c0:34:04:cd:28:34:2f:61:91:72:
+ fe:9c:e9:85:83:ff:8e:4f:12:32:ee:f2:81:83:c3:
+ fe:3b:1b:4c:6f:ad:73:3b:b5:fc:bc:2e:c2:20:05:
+ c5:8e:f1:83:7d:16:83:b2:c6:f3:4a:26:c1:b2:ef:
+ fa:88:6b:42:38:61:1f:cf:dc:de:35:5b:3b:65:19:
+ 03:5b:bc:34:f4:de:f9:9c:02:38:61:b4:6f:c9:d6:
+ e6:c9:07:7a:d9:1d:26:91:f7:f7:ee:59:8c:b0:fa:
+ c1:86:d9:1c:ae:fe:13:09:85:13:92:70:b4:13:0c:
+ 93:bc:43:79:44:f4:fd:44:52:e2:d7:4d:d3:64:f2:
+ e2:1e:71:f5:4b:ff:5c:ae:82:ab:9c:9d:f6:9e:e8:
+ 6d:2b:c5:22:36:3a:0d:ab:c5:21:97:9b:0d:ea:da:
+ 1d:bf:9a:42:d5:c4:48:4e:0a:bc:d0:6b:fa:53:dd:
+ ef:3c:1b:20:ee:3f:d5:9d:7c:25:e4:1d:2b:66:c6:
+ 2e:37:ff:ff:ff:ff:ff:ff:ff:ff
+ generator: 2 (0x2)
+ recommended-private-length: 276 bits
+-----BEGIN DH PARAMETERS-----
+MIIBjAKCAYEA//////////+t+FRYortKmq/cViAnPTzx2LnFg84tNpWp4TZBFGQz
++8yTnc4kmz75fS/jY2MMddj2gbICrsRhetPfHtXV/WVhJDP1H18GbtCFY2VVPe0a
+87VXE15/V8k1mE8McODmi3fipona8+/och3xWKE2rec1MKzKT0g6eXq8CrGCsyT7
+YdEIqUuyyOP7uWrat2DX9GgdT0Kj3jlN9K5W7edjcrsZCwenyO4KbXCeAvzhzffi
+7MA0BM0oNC9hkXL+nOmFg/+OTxIy7vKBg8P+OxtMb61zO7X8vC7CIAXFjvGDfRaD
+ssbzSibBsu/6iGtCOGEfz9zeNVs7ZRkDW7w09N75nAI4YbRvydbmyQd62R0mkff3
+7lmMsPrBhtkcrv4TCYUTknC0EwyTvEN5RPT9RFLi103TZPLiHnH1S/9croKrnJ32
+nuhtK8UiNjoNq8Uhl5sN6todv5pC1cRITgq80Gv6U93vPBsg7j/VnXwl5B0rZsYu
+N///////////AgECAgIBFA==
+-----END DH PARAMETERS-----
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 44c2725d2c2f7..ad85b3e8ea92e 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -72,7 +72,7 @@ def data_file(*name):
NULLBYTECERT = data_file("nullbytecert.pem")
TALOS_INVALID_CRLDP = data_file("talos-2019-0758.pem")
-DHFILE = data_file("dh1024.pem")
+DHFILE = data_file("ffdh3072.pem")
BYTES_DHFILE = os.fsencode(DHFILE)
1
0
bpo-41193: Ignore OSError in readline write_history() (GH-21279)
by Miss Islington (bot) July 2, 2020
by Miss Islington (bot) July 2, 2020
July 2, 2020
https://github.com/python/cpython/commit/53d2b715d10e5c81cb9c86fd25e88ace4e…
commit: 53d2b715d10e5c81cb9c86fd25e88ace4e41bc25
branch: 3.8
author: Miss Islington (bot) <31488909+miss-islington(a)users.noreply.github.com>
committer: GitHub <noreply(a)github.com>
date: 2020-07-02T04:02:08-07:00
summary:
bpo-41193: Ignore OSError in readline write_history() (GH-21279)
The write_history() atexit function of the readline completer now
ignores any OSError to ignore error if the filesystem is read-only,
instead of only ignoring FileNotFoundError and PermissionError.
(cherry picked from commit 0ab917e07ed64c6bfde6f6e791f9b28acc97b510)
Co-authored-by: Victor Stinner <vstinner(a)python.org>
files:
A Misc/NEWS.d/next/Library/2020-07-02-11-53-45.bpo-41193.8-Tnql.rst
M Lib/site.py
diff --git a/Lib/site.py b/Lib/site.py
index a065ab0b5db58..9fa21cca38667 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -444,9 +444,9 @@ def register_readline():
def write_history():
try:
readline.write_history_file(history)
- except (FileNotFoundError, PermissionError):
- # home directory does not exist or is not writable
- # https://bugs.python.org/issue19891
+ except OSError:
+ # bpo-19891, bpo-41193: Home directory does not exist
+ # or is not writable, or the filesystem is read-only.
pass
atexit.register(write_history)
diff --git a/Misc/NEWS.d/next/Library/2020-07-02-11-53-45.bpo-41193.8-Tnql.rst b/Misc/NEWS.d/next/Library/2020-07-02-11-53-45.bpo-41193.8-Tnql.rst
new file mode 100644
index 0000000000000..8807d9c21febd
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-07-02-11-53-45.bpo-41193.8-Tnql.rst
@@ -0,0 +1,4 @@
+The ``write_history()`` atexit function of the readline completer now
+ignores any :exc:`OSError` to ignore error if the filesystem is read-only,
+instead of only ignoring :exc:`FileNotFoundError` and
+:exc:`PermissionError`.
1
0
July 2, 2020
https://github.com/python/cpython/commit/0ab917e07ed64c6bfde6f6e791f9b28acc…
commit: 0ab917e07ed64c6bfde6f6e791f9b28acc97b510
branch: master
author: Victor Stinner <vstinner(a)python.org>
committer: GitHub <noreply(a)github.com>
date: 2020-07-02T12:43:25+02:00
summary:
bpo-41193: Ignore OSError in readline write_history() (GH-21279)
The write_history() atexit function of the readline completer now
ignores any OSError to ignore error if the filesystem is read-only,
instead of only ignoring FileNotFoundError and PermissionError.
files:
A Misc/NEWS.d/next/Library/2020-07-02-11-53-45.bpo-41193.8-Tnql.rst
M Lib/site.py
diff --git a/Lib/site.py b/Lib/site.py
index 544306cd40e32..8979365cafc37 100644
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -462,9 +462,9 @@ def register_readline():
def write_history():
try:
readline.write_history_file(history)
- except (FileNotFoundError, PermissionError):
- # home directory does not exist or is not writable
- # https://bugs.python.org/issue19891
+ except OSError:
+ # bpo-19891, bpo-41193: Home directory does not exist
+ # or is not writable, or the filesystem is read-only.
pass
atexit.register(write_history)
diff --git a/Misc/NEWS.d/next/Library/2020-07-02-11-53-45.bpo-41193.8-Tnql.rst b/Misc/NEWS.d/next/Library/2020-07-02-11-53-45.bpo-41193.8-Tnql.rst
new file mode 100644
index 0000000000000..8807d9c21febd
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-07-02-11-53-45.bpo-41193.8-Tnql.rst
@@ -0,0 +1,4 @@
+The ``write_history()`` atexit function of the readline completer now
+ignores any :exc:`OSError` to ignore error if the filesystem is read-only,
+instead of only ignoring :exc:`FileNotFoundError` and
+:exc:`PermissionError`.
1
0
https://github.com/python/cpython/commit/d565be84993a3d618add139cf21038e12c…
commit: d565be84993a3d618add139cf21038e12c60a13e
branch: 3.5
author: Christian Heimes <christian(a)python.org>
committer: GitHub <noreply(a)github.com>
date: 2020-07-02T00:07:15-07:00
summary:
bpo-41183: Update test certs and keys (#21258)
Manual backport of bpo-34542, GH-8997 and commit
1da2b23504a68ed0432aa74a17ec2533933f5af8 to Python 3.5.
Signed-off-by: Christian Heimes <christian(a)python.org>
files:
A Misc/NEWS.d/next/Library/2020-07-01-16-59-46.bpo-41183.9stVAW.rst
M Lib/test/allsans.pem
M Lib/test/keycert.passwd.pem
M Lib/test/keycert.pem
M Lib/test/keycert2.pem
M Lib/test/keycert3.pem
M Lib/test/keycert4.pem
M Lib/test/make_ssl_certs.py
M Lib/test/pycacert.pem
M Lib/test/pycakey.pem
M Lib/test/revocation.crl
M Lib/test/ssl_cert.pem
M Lib/test/ssl_key.passwd.pem
M Lib/test/ssl_key.pem
M Lib/test/test_asyncio/test_events.py
M Lib/test/test_ssl.py
diff --git a/Lib/test/allsans.pem b/Lib/test/allsans.pem
index 3ee4f59513abf..6eebde7a57f15 100644
--- a/Lib/test/allsans.pem
+++ b/Lib/test/allsans.pem
@@ -1,37 +1,81 @@
-----BEGIN PRIVATE KEY-----
-MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAOoy7/QOtTjQ0niE
-6uDcTwtkC0R2Tvy1AjVnXohCntZfdzbTGDoYTgXSOLsP8A697jUiJ8VCePGH50xG
-Z4DKnAF3a9O3a9nr2pLXb0iY3XOMv+YEBii7CfI+3oxFYgCl0sMgHzDD2ZTVYAsm
-DWgLUVsE2gHEccRwrM2tPf2EgR+FAgMBAAECgYEA3qyfyYVSeTrTYxO93x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/YRX/0nogK3BHqpUHrfCdEYZkciRxtAa+OPpWn4dcZi+Fpf7
+ZYSgPLNt+djtFDMIAk5Bo+XDaQdW3dhF0w44enrGAOV0xPE+/jOuenNhKBafjuNb
+lkeSr45+QZsi1rd18ny8z3uuaGqIAziFgmllZOH2D8giTn6+5jZcCNZCoGKUkPI9
+l/GMWwxg4HQYYlZcsZzTCem9Rb2XcrasAbmhFapMtR+QAwSed5vKE7ZdtQhj74kB
+7Q0E7Lkgpp6BaObb2As8/f0K/UlSVSvrYk+i3JT9wK/qqkRGxsTFEF7N9t0rKu8y
+4JdQDtZCI552MsFvYW6m+IOYgxg=
-----END CERTIFICATE-----
diff --git a/Lib/test/keycert.passwd.pem b/Lib/test/keycert.passwd.pem
index e90574881db54..c330c36d8f9fd 100644
--- a/Lib/test/keycert.passwd.pem
+++ b/Lib/test/keycert.passwd.pem
@@ -1,33 +1,69 @@
------BEGIN RSA PRIVATE KEY-----
-Proc-Type: 4,ENCRYPTED
-DEK-Info: DES-EDE3-CBC,1A8D9D2A02EC698A
-
-kJYbfZ8L0sfe9Oty3gw0aloNnY5E8fegRfQLZlNoxTl6jNt0nIwI8kDJ36CZgR9c
-u3FDJm/KqrfUoz8vW+qEnWhSG7QPX2wWGPHd4K94Yz/FgrRzZ0DoK7XxXq9gOtVA
-AVGQhnz32p+6WhfGsCr9ArXEwRZrTk/FvzEPaU5fHcoSkrNVAGX8IpSVkSDwEDQr
-Gv17+cfk99UV1OCza6yKHoFkTtrC+PZU71LomBabivS2Oc4B9hYuSR2hF01wTHP+
-YlWNagZOOVtNz4oKK9x9eNQpmfQXQvPPTfusexKIbKfZrMvJoxcm1gfcZ0H/wK6P
-6wmXSG35qMOOztCZNtperjs1wzEBXznyK8QmLcAJBjkfarABJX9vBEzZV0OUKhy+
-noORFwHTllphbmydLhu6ehLUZMHPhzAS5UN7srtpSN81eerDMy0RMUAwA7/PofX1
-94Me85Q8jP0PC9ETdsJcPqLzAPETEYu0ELewKRcrdyWi+tl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w9xF8itV4Uvcdr3dwqByvIqn7iI/gB+4l41e0u8OmH2MKOx4Nxlly5TNW
+HcVKQHyOeyvnINuBAQ==
-----END CERTIFICATE-----
+
diff --git a/Lib/test/keycert.pem b/Lib/test/keycert.pem
index 64318aa2e03a6..0d398633739a5 100644
--- a/Lib/test/keycert.pem
+++ b/Lib/test/keycert.pem
@@ -1,31 +1,66 @@
-----BEGIN PRIVATE KEY-----
-MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBANtb0+YrKuxevGpm
-LrjaUhZSgz6zFAmuGFmKmUbdjmfv9zSmmdsQIksK++jK0Be9LeZy20j6ahOfuVa0
-ufEmPoP7Fy4hXegKZR9cCWcIe/A6H2xWF1IIJLRTLaU8ol/I7T+um5HD5AwAwNPP
-USNU0Eegmvp+xxWu3NX2m1Veot85AgMBAAECgYA3ZdZ673X0oexFlq7AAmrutkHt
-CL7LvwrpOiaBjhyTxTeSNWzvtQBkIU8DOI0bIazA4UreAFffwtvEuPmonDb3F+Iq
-SMAu42XcGyVZEl+gHlTPU9XRX7nTOXVt+MlRRRxL6t9GkGfUAXI3XxJDXW3c0vBK
-UL9xqD8cORXOfE06rQJBAP8mEX1ERkR64Ptsoe4281vjTlNfIbs7NMPkUnrn9N/Y
-BLhjNIfQ3HFZG8BTMLfX7kCS9D593DW5tV4Z9BP/c6cCQQDcFzCcVArNh2JSywOQ
-ZfTfRbJg/Z5Lt9Fkngv1meeGNPgIMLN8Sg679pAOOWmzdMO3V706rNPzSVMME7E5
-oPIfAkEA8pDddarP5tCvTTgUpmTFbakm0KoTZm2+FzHcnA4jRh+XNTjTOv98Y6Ik
-eO5d1ZnKXseWvkZncQgxfdnMqqpj5wJAcNq/RVne1DbYlwWchT2Si65MYmmJ8t+F
-0mcsULqjOnEMwf5e+ptq5LzwbyrHZYq5FNk7ocufPv/ZQrcSSC+cFwJBAKvOJByS
-x56qyGeZLOQlWS2JS3KJo59XuLFGqcbgN9Om9xFa41Yb4N9N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wFjAUBgNVHREEDTALgglsb2NhbGhvc3QwDQYJKoZI
+hvcNAQELBQADggGBAHRUO/UIHl3jXQENewYayHxkIx8t7nu40iO2DXbicSijz5bo
+5//xAB6RxhBAlsDBehgQP1uoZg+WJW+nHu3CIVOU3qZNZRaozxiCl2UFKcNqLOmx
+R3NKpo1jYf4REQIeG8Yw9+hSWLRbshNteP6bKUUf+vanhg9+axyOEOH/iOQvgk/m
+b8wA8wNa4ujWljPbTQnj7ry8RqhTM0GcAN5LSdSvcKcpzLcs3aYwh+Z8e30sQWna
+F40sa5u7izgBTOrwpcDm/w5kC46vpRQ5fnbshVw6pne2by0mdMECASid/p25N103
+jMqTFlmO7kpf/jpCSmamp3/JSEE1BJKHwQ6Ql4nzRA2N1mnvWH7Zxcv043gkHeAu
+0x8evpvwuhdIyproejNFlBpKmW8OX7yKTCPPMC/VkX8Q1rVkxU0DQ6hmvwZlhoKa
+9Wc2uXpw9xF8itV4Uvcdr3dwqByvIqn7iI/gB+4l41e0u8OmH2MKOx4Nxlly5TNW
+HcVKQHyOeyvnINuBAQ==
-----END CERTIFICATE-----
diff --git a/Lib/test/keycert2.pem b/Lib/test/keycert2.pem
index e8a9e082b313a..ed6ae85a4649d 100644
--- a/Lib/test/keycert2.pem
+++ b/Lib/test/keycert2.pem
@@ -1,31 +1,66 @@
-----BEGIN PRIVATE KEY-----
-MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAJnsJZVrppL+W5I9
-zGQrrawWwE5QJpBK9nWw17mXrZ03R1cD9BamLGivVISbPlRlAVnZBEyh1ATpsB7d
-CUQ+WHEvALquvx4+Yw5l+fXeiYRjrLRBYZuVy8yNtXzU3iWcGObcYRkUdiXdOyP7
-sLF2YZHRvQZpzgDBKkrraeQ81w21AgMBAAECgYBEm7n07FMHWlE+0kT0sXNsLYfy
-YE+QKZnJw9WkaDN+zFEEPELkhZVt5BjsMraJr6v2fIEqF0gGGJPkbenffVq2B5dC
-lWUOxvJHufMK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aPXcc9CZBtr
+oOjwwiLEqdkpxUj13mJYTlt5wsS/Kw==
-----END CERTIFICATE-----
diff --git a/Lib/test/keycert3.pem b/Lib/test/keycert3.pem
index 5bfa62c4ca30b..e0a8205a660e8 100644
--- a/Lib/test/keycert3.pem
+++ b/Lib/test/keycert3.pem
@@ -1,73 +1,164 @@
-----BEGIN PRIVATE KEY-----
-MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAMLgD0kAKDb5cFyP
-jbwNfR5CtewdXC+kMXAWD8DLxiTTvhMW7qVnlwOm36mZlszHKvsRf05lT4pegiFM
-9z2j1OlaN+ci/X7NU22TNN6crYSiN77FjYJP464j876ndSxyD+rzys386T+1r1aZ
-aggEdkj1TsSsv1zWIYKlPIjlvhuxAgMBAAECgYA0aH+T2Vf3WOPv8KdkcJg6gCRe
-yJKXOWgWRcicx/CUzOEsTxmFIDPLxqAWA3k7v0B+3vjGw5Y9lycV/5XqXNoQI14j
-y09iNsumds13u5AKkGdTJnZhQ7UKdoVHfuP44ZdOv/rJ5/VD6F4zWywpe90pcbK+
-AWDVtusgGQBSieEl1QJBAOyVrUG5l2yoUBtd2zr/kiGm/DYyXlIthQO/A3/LngDW
-5/ydGxVsT7lAVOgCsoT+0L4efTh90PjzW8LPQrPBWVMCQQDS3h/FtYYd5lfz+FNL
-9CEe1F1w9l8P749uNUD0g317zv1tatIqVCsQWHfVHNdVvfQ+vSFw38OORO00Xqs9
-1GJrAkBkoXXEkxCZoy4PteheO/8IWWLGGr6L7di6MzFl1lIqwT6D8L9oaV2vynFT
-DnKop0pa09Unhjyw57KMNmSE2SUJAkEArloTEzpgRmCq4IK2/NpCeGdHS5uqRlbh
-1VIa/xGps7EWQl5Mn8swQDel/YP3WGHTjfx7pgSegQfkyaRtGpZ9OQJAa9Vumj8m
-JAAtI0Bnga8hgQx7BhTQY4CadDxyiRGOGYhwUzYVCqkb2sbVRH9HnwUaJT7cWBY3
-RnJdHOMXWem7/w==
+MIIG/Q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Xn4EOcObNghw2KqqNUUWfOeBPwBA1FxzM4BrAStp
+DBINpGS4Dc0mjViVegECgcA3hTtm82XdxQXj9LQmb/E3lKx/7H87XIOeNMmvjYuZ
+iS9wKrkF+u42vyoDxcKMCnxP5056wpdST4p56r+SBwVTHcc3lGBSGcMTIfwRXrj3
+thOA2our2n4ouNIsYyTlcsQSzifwmpRmVMRPxl9fYVdEWUgB83FgHT0D9avvZnF9
+t9OccnGJXShAIZIBADhVj/JwG4FbaX42NijD5PNpVLk1Y17OV0I576T9SfaQoBjJ
+aH1M/zC4aVaS0DYB/Gxq7v8=
-----END PRIVATE KEY-----
Certificate:
Data:
- Version: 1 (0x0)
- Serial Number: 12723342612721443281 (0xb09264b1f2da21d1)
- Signature Algorithm: sha1WithRSAEncryption
+ Version: 3 (0x2)
+ Serial Number:
+ cb:2d:80:99:5a:69:52:5c
+ Signature Algorithm: sha256WithRSAEncryption
Issuer: C=XY, O=Python Software Foundation CA, CN=our-ca-server
Validity
- Not Before: Jan 4 19:47:07 2013 GMT
- Not After : Nov 13 19:47:07 2022 GMT
+ Not Before: Aug 29 14:23:16 2018 GMT
+ Not After : Jul 7 14:23:16 2028 GMT
Subject: C=XY, L=Castle Anthrax, O=Python Software Foundation, CN=localhost
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
- Public-Key: (1024 bit)
+ Public-Key: (3072 bit)
Modulus:
- 00:c2:e0:0f:49:00:28:36:f9:70:5c:8f:8d:bc:0d:
- 7d:1e:42:b5:ec:1d:5c:2f:a4:31:70:16:0f:c0:cb:
- c6:24:d3:be:13:16:ee:a5:67:97:03:a6:df:a9:99:
- 96:cc:c7:2a:fb:11:7f:4e:65:4f:8a:5e:82:21:4c:
- f7:3d:a3:d4:e9:5a:37:e7:22:fd:7e:cd:53:6d:93:
- 34:de:9c:ad:84:a2:37:be:c5:8d:82:4f:e3:ae:23:
- f3:be:a7:75:2c:72:0f:ea:f3:ca:cd:fc:e9:3f:b5:
- af:56:99:6a:08:04:76:48:f5:4e:c4:ac:bf:5c:d6:
- 21:82:a5:3c:88:e5:be:1b:b1
+ 00:9f:28:2f:37:41:ef:7f:64:63:16:62:16:e9:01:
+ 14:62:29:ca:3a:98:92:3d:08:d3:5e:69:fe:c0:f3:
+ d4:c4:fb:0e:58:dc:64:b0:4b:cb:b3:aa:9e:42:e9:
+ 07:9b:67:33:cd:b9:e8:3c:1d:8a:13:c0:df:39:67:
+ 7c:4c:d3:7e:bf:43:0f:4a:85:05:6d:87:e5:c3:02:
+ a3:3e:d7:d7:b9:28:79:18:73:18:37:77:76:48:d4:
+ 78:18:d7:bd:1e:6a:46:8b:06:f3:03:37:95:0b:a0:
+ 53:b0:22:cd:8f:b7:03:36:a3:d7:23:77:99:9f:4a:
+ e5:ad:b4:8e:be:7c:2a:a8:a7:cf:e5:f1:c7:ab:1b:
+ d8:97:d8:61:f7:f6:9d:e2:5b:05:a8:4d:9b:98:9d:
+ d0:00:f6:a6:2f:d3:b6:16:6a:3b:90:d4:44:96:28:
+ f8:c7:60:64:e7:32:fb:b8:c4:8c:e2:6c:2d:66:5d:
+ dd:8c:ea:ef:c8:8c:d3:ba:83:8d:ba:48:a1:5a:44:
+ 35:90:93:1d:35:80:85:7f:0b:22:ac:f4:38:19:a1:
+ e3:07:90:a6:6e:3e:a6:55:3b:13:8a:f8:0f:cd:ae:
+ 6a:ea:1c:5b:0f:22:ca:ec:e7:09:3b:40:05:63:bb:
+ 9f:d7:d6:c9:29:9f:f5:06:42:59:8c:47:00:5a:41:
+ 42:ce:b3:51:5a:80:0f:b9:e1:15:d4:ea:a5:0f:5b:
+ 46:26:84:9e:31:38:1e:20:1c:70:f5:be:30:0a:12:
+ c4:59:ef:fe:b3:73:13:32:3a:6f:8c:d4:36:ca:45:
+ 31:f8:35:68:d5:5a:99:d8:f1:76:95:19:d4:61:b5:
+ 3a:47:f4:c8:f2:72:92:a1:17:e0:f6:65:dc:b6:b5:
+ 05:ed:aa:ed:86:75:c3:27:51:e7:6d:d7:77:e7:f7:
+ 10:ee:3f:83:e8:a6:11:34:8a:9f:c8:32:09:fe:91:
+ be:26:f5:ef:92:f8:af:65:95:d4:25:d0:1f:b8:05:
+ c1:96:02:a1:de:96:1d:8a:b9:4d
Exponent: 65537 (0x10001)
- Signature Algorithm: sha1WithRSAEncryption
- 2f:42:5f:a3:09:2c:fa:51:88:c7:37:7f:ea:0e:63:f0:a2:9a:
- e5:5a:e2:c8:20:f0:3f:60:bc:c8:0f:b6:c6:76:ce:db:83:93:
- f5:a3:33:67:01:8e:04:cd:00:9a:73:fd:f3:35:86:fa:d7:13:
- e2:46:c6:9d:c0:29:53:d4:a9:90:b8:77:4b:e6:83:76:e4:92:
- d6:9c:50:cf:43:d0:c6:01:77:61:9a:de:9b:70:f7:72:cd:59:
- 00:31:69:d9:b4:ca:06:9c:6d:c3:c7:80:8c:68:e6:b5:a2:f8:
- ef:1d:bb:16:9f:77:77:ef:87:62:22:9b:4d:69:a4:3a:1a:f1:
- 21:5e:8c:32:ac:92:fd:15:6b:18:c2:7f:15:0d:98:30:ca:75:
- 8f:1a:71:df:da:1d:b2:ef:9a:e8:2d:2e:02:fd:4a:3c:aa:96:
- 0b:06:5d:35:b3:3d:24:87:4b:e0:b0:58:60:2f:45:ac:2e:48:
- 8a:b0:99:10:65:27:ff:cc:b1:d8:fd:bd:26:6b:b9:0c:05:2a:
- f4:45:63:35:51:07:ed:83:85:fe:6f:69:cb:bb:40:a8:ae:b6:
- 3b:56:4a:2d:a4:ed:6d:11:2c:4d:ed:17:24:fd:47:bc:d3:41:
- a2:d3:06:fe:0c:90:d8:d8:94:26:c4:ff:cc:a1:d8:42:77:eb:
- fc:a9:94:71
+ X509v3 extensions:
+ X509v3 Subject Alternative Name:
+ DNS:localhost
+ X509v3 Key Usage: critical
+ Digital Signature, Key Encipherment
+ X509v3 Extended Key Usage:
+ TLS Web Server Authentication, TLS Web Client Authentication
+ X509v3 Basic Constraints: critical
+ CA:FALSE
+ X509v3 Subject Key Identifier:
+ 8F:EA:1D:E3:33:5C:00:16:B3:8B:6F:6B:6F:D3:4C:CB:B5:CB:7C:55
+ X509v3 Authority Key Identifier:
+ keyid:DD:BF:CA:DA:E6:D1:34:BA:37:75:21:CA:6F:9A:08:28:F2:35:B6:48
+ DirName:/C=XY/O=Python Software Foundation CA/CN=our-ca-server
+ serial:CB:2D:80:99:5A:69:52:5B
+
+ Authority Information Access:
+ CA Issuers - URI:http://testca.pythontest.net/testca/pycacert.cer
+ OCSP - URI:http://testca.pythontest.net/testca/ocsp/
+
+ X509v3 CRL Distribution Points:
+
+ Full Name:
+ URI:http://testca.pythontest.net/testca/revocation.crl
+
+ Signature Algorithm: sha256WithRSAEncryption
+ 27:f5:8c:59:10:f4:c6:e7:28:00:bf:ba:8d:7b:13:03:f1:1c:
+ a6:5f:b3:06:55:a4:22:b9:db:b2:d5:46:bd:f7:0c:dd:43:6e:
+ b4:79:65:67:21:0c:2a:55:ee:40:8e:85:9f:9f:47:bb:0a:2a:
+ 4d:b6:64:74:98:a0:7f:ae:dc:f1:2e:db:42:77:18:e0:75:8b:
+ 26:35:68:c3:41:ed:6b:c8:77:72:6f:6a:9a:5d:55:69:02:fd:
+ 5a:54:c8:57:cb:b0:65:03:16:e2:0f:00:39:99:66:a0:9b:88:
+ 93:17:e2:5a:2d:79:35:5f:97:57:78:c4:af:f5:99:5e:86:ab:
+ d3:11:ad:1a:a2:0d:fa:52:10:b9:fe:bf:9d:ce:33:d9:86:b2:
+ 9c:16:f8:d6:75:08:8a:db:0a:e5:b4:2b:16:7f:b4:f9:2a:9f:
+ c3:d2:77:d7:cd:65:1e:f4:6c:1e:eb:59:b9:f0:ae:5f:a4:1f:
+ cc:4a:c4:b9:7a:a9:d9:6b:32:68:3b:e1:65:b0:84:b7:90:c4:
+ ae:fe:f4:37:4f:21:a0:de:9f:3a:b1:e5:cc:16:04:66:3f:0b:
+ 41:dc:42:3d:20:3e:ec:b7:95:2b:35:57:fa:be:7f:b6:3a:ba:
+ ca:4f:58:fe:75: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xK7+9DdP
+IaDenzqx5cwWBGY/C0HcQj0gPuy3lSs1V/q+f7Y6uspPWP51PgiJLIywXS75iRAr
++UFGTzwAtyfTZSQoFyMmMULqfk6T5HtoVMqfRvPvK+mFDLWEstU1NIB1K/CRI7gI
+AY65ClTU+zRS/tlF8IA7tsFvgtEf8jsI9kamlidhS1gyeg4dWcVErV4aeTPB1AUv
+StPYQkKNM+NjytWHl5tNuBoDNLsc0gI/WSPiI4CIY8LwomOoiw==
-----END CERTIFICATE-----
diff --git a/Lib/test/keycert4.pem b/Lib/test/keycert4.pem
index 53355c8a50cba..d1ebb82486de2 100644
--- a/Lib/test/keycert4.pem
+++ b/Lib/test/keycert4.pem
@@ -1,73 +1,164 @@
-----BEGIN PRIVATE KEY-----
-MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAK5UQiMI5VkNs2Qv
-L7gUaiDdFevNUXRjU4DHAe3ZzzYLZNE69h9gO9VCSS16tJ5fT5VEu0EZyGr0e3V2
-NkX0ZoU0Hc/UaY4qx7LHmn5SYZpIxhJnkf7SyHJK1zUaGlU0/LxYqIuGCtF5dqx1
-L2OQhEx1GM6RydHdgX69G64LXcY5AgMBAAECgYAhsRMfJkb9ERLMl/oG/5sLQu9L
-pWDKt6+ZwdxzlZbggQ85CMYshjLKIod2DLL/sLf2x1PRXyRG131M1E3k8zkkz6de
-R1uDrIN/x91iuYzfLQZGh8bMY7Yjd2eoroa6R/7DjpElGejLxOAaDWO0ST2IFQy9
-myTGS2jSM97wcXfsSQJBANP3jelJoS5X6BRjTSneY21wcocxVuQh8pXpErALVNsT
-drrFTeaBuZp7KvbtnIM5g2WRNvaxLZlAY/hXPJvi6ncCQQDSix1cebml6EmPlEZS
-Mm8gwI2F9ufUunwJmBJcz826Do0ZNGByWDAM/JQZH4FX4GfAFNuj8PUb+GQfadkx
-i1DPAkEA0lVsNHojvuDsIo8HGuzarNZQT2beWjJ1jdxh9t7HrTx7LIps6rb/fhOK
-Zs0R6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YPYRpapx0CgcByCtQixzcAA1u5knR9pkT76ris3YnA0Ptqk3I3XiBjoGjK
+pL0CICUVBMpvmTdKai12a8DDwgqiOaZJJTchxH63NAHNGzkeFkuq5IdYrzB/bHBr
+WbzukjZs6KXVv4oKg7ioVAu6rN7iBaO7x8BWzk8i0EHMzFCto1+rRM1e6HEsUBOj
+v7LIU0+dmZGUGLRIbhhQPR3Yb6ZatSwyiKc23vmKZqHmUqbQOaqBm6te7beDRugF
+XJVY9sqs9IJyhYpVHlUCgcAPoslwYKeAXagsxdQrH3D9VJDXVOHWKMBqQZDio5dB
+Q80uWpuxtt6nhZkQO1JIWnYb6v+zbDbcgjByBIDuxCdBW9d+QQnanKmVyrXguK91
+C3OcHHOmSduFdWC3/zYW1mW97Tz1sXyam2hly1u3L5kW+GnE1hr9VVPjQNrO9+Ge
+qW0coaJqKY78q3Rm2dtyZeJSFFI1o/DQ3blyItsFpg/QrR+a5XrS6Nw2ZLIL4Azo
+J1CTgMwjhwlMNCI4t4dkHd0=
-----END PRIVATE KEY-----
Certificate:
Data:
- Version: 1 (0x0)
- Serial Number: 12723342612721443282 (0xb09264b1f2da21d2)
- Signature Algorithm: sha1WithRSAEncryption
+ Version: 3 (0x2)
+ Serial Number:
+ cb:2d:80:99:5a:69:52:5d
+ Signature Algorithm: sha256WithRSAEncryption
Issuer: C=XY, O=Python Software Foundation CA, CN=our-ca-server
Validity
- Not Before: Jan 4 19:47:07 2013 GMT
- Not After : Nov 13 19:47:07 2022 GMT
+ Not Before: Aug 29 14:23:16 2018 GMT
+ Not After : Jul 7 14:23:16 2028 GMT
Subject: C=XY, L=Castle Anthrax, O=Python Software Foundation, CN=fakehostname
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
- Public-Key: (1024 bit)
+ Public-Key: (3072 bit)
Modulus:
- 00:ae:54:42:23:08:e5:59:0d:b3:64:2f:2f:b8:14:
- 6a:20:dd:15:eb:cd:51:74:63:53:80:c7:01:ed:d9:
- cf:36:0b:64:d1:3a:f6:1f:60:3b:d5:42:49:2d:7a:
- b4:9e:5f:4f:95:44:bb:41:19:c8:6a:f4:7b:75:76:
- 36:45:f4:66:85:34:1d:cf:d4:69:8e:2a:c7:b2:c7:
- 9a:7e:52:61:9a:48:c6:12:67:91:fe:d2:c8:72:4a:
- d7:35:1a:1a:55:34:fc:bc:58:a8:8b:86:0a:d1:79:
- 76:ac:75:2f:63:90:84:4c:75:18:ce:91:c9:d1:dd:
- 81:7e:bd:1b:ae:0b:5d:c6:39
+ 00:c6:8e:98:87:ce:ae:e0:87:18:4c:67:3a:e7:46:
+ c1:81:0b:f7:26:c3:c1:11:10:87:5b:aa:5a:f3:fe:
+ 5f:01:15:a5:9e:8a:9b:ce:e4:76:ff:33:25:3c:c6:
+ cd:b3:2d:4a:ea:22:bd:89:35:ff:84:8a:2f:18:9b:
+ 86:d8:99:97:25:16:b6:b8:8e:89:9a:89:29:71:4d:
+ 93:9e:dd:d3:15:f2:6e:2f:02:ae:1e:4f:69:92:7d:
+ 96:42:d7:e5:c0:ba:da:9d:cf:b5:a1:1f:18:4c:54:
+ 49:b7:03:24:d6:bd:30:b7:a8:26:e7:95:b5:f9:54:
+ 8a:10:53:01:6b:b1:25:aa:0e:21:f2:68:67:4a:de:
+ ba:ce:4c:a1:54:28:cf:18:3e:2a:bf:05:99:26:e8:
+ 0e:1e:88:57:22:e7:07:7f:48:f0:fe:c3:4a:48:b1:
+ c6:5b:41:6d:4c:52:be:5b:b3:9e:2e:ca:55:9a:52:
+ 6b:5f:23:c2:89:b7:a0:43:65:0f:ee:03:4e:9c:ea:
+ 2f:3a:de:c4:82:10:8e:8b:82:af:b0:ca:29:1e:24:
+ 63:4c:c5:93:1f:82:ed:dd:cd:fb:f8:06:26:41:41:
+ 7d:19:86:24:6f:aa:c7:83:49:d3:dc:b9:56:b6:21:
+ f6:fa:08:59:60:db:df:27:7b:07:98:e0:40:08:13:
+ 53:be:ba:aa:39:87:c1:45:d5:a5:0e:31:9a:50:11:
+ 9b:b3:b2:9f:51:fd:30:0c:04:75:f5:62:65:63:1b:
+ f9:11:74:17:9a:1d:ed:f0:87:30:75:3d:fb:9e:3c:
+ 85:f6:65:33:26:2c:d6:1b:61:b7:e7:9b:18:64:d6:
+ 79:fc:68:0b:e8:4f:df:29:37:0f:32:df:fd:a4:d8:
+ a3:6c:bb:6e:27:f6:e4:a4:93:10:28:a8:9d:7d:58:
+ ac:26:98:bf:0c:a4:92:80:cc:bb:f8:e6:d4:6f:84:
+ df:90:2e:d9:d1:76:ef:8b:27:d9:b6:f6:7a:50:1c:
+ 59:98:2d:b7:6a:45:f9:a2:76:73
Exponent: 65537 (0x10001)
- Signature Algorithm: sha1WithRSAEncryption
- ad:45:8a:8e:ef:c6:ef:04:41:5c:2c:4a:84:dc:02:76:0c:d0:
- 66:0f:f0:16:04:58:4d:fd:68:b7:b8:d3:a8:41:a5:5c:3c:6f:
- 65:3c:d1:f8:ce:43:35:e7:41:5f:53:3d:c9:2c:c3:7d:fc:56:
- 4a:fa:47:77:38:9d:bb:97:28:0a:3b:91:19:7f:bc:74:ae:15:
- 6b:bd:20:36:67:45:a5:1e:79:d7:75:e6:89:5c:6d:54:84:d1:
- 95:d7:a7:b4:33:3c:af:37:c4:79:8f:5e:75:dc:75:c2:18:fb:
- 61:6f:2d:dc:38:65:5b:ba:67:28:d0:88:d7:8d:b9:23:5a:8e:
- e8:c6:bb:db:ce:d5:b8:41:2a:ce:93:08:b6:95:ad:34:20:18:
- d5:3b:37:52:74:50:0b:07:2c:b0:6d:a4:4c:7b:f4:e0:fd:d1:
- af:17:aa:20:cd:62:e3:f0:9d:37:69:db:41:bd:d4:1c:fb:53:
- 20:da:88:9d:76:26:67:ce:01:90:a7:80:1d:a9:5b:39:73:68:
- 54:0a:d1:2a:03:1b:8f:3c:43:5d:5d:c4:51:f1:a7:e7:11:da:
- 31:2c:49:06:af:04:f4:b8:3c:99:c4:20:b9:06:36:a2:00:92:
- 61:1d:0c:6d:24:05:e2:82:e1:47:db:a0:5f:ba:b9:fb:ba:fa:
- 49:12:1e:ce
+ X509v3 extensions:
+ X509v3 Subject Alternative Name:
+ DNS:fakehostname
+ X509v3 Key Usage: critical
+ Digital Signature, Key Encipherment
+ X509v3 Extended Key Usage:
+ TLS Web Server Authentication, TLS Web Client Authentication
+ X509v3 Basic Constraints: critical
+ CA:FALSE
+ X509v3 Subject Key Identifier:
+ 52:E0:93:AA:52:55:B7:BB:E7:A8:E0:8C:DE:41:2E:F4:07:F0:36:FB
+ X509v3 Authority Key Identifier:
+ keyid:DD:BF:CA:DA:E6:D1:34:BA:37:75:21:CA:6F:9A:08:28:F2:35:B6:48
+ DirName:/C=XY/O=Python Software Foundation CA/CN=our-ca-server
+ serial:CB:2D:80:99:5A:69:52:5B
+
+ Authority Information Access:
+ CA Issuers - URI:http://testca.pythontest.net/testca/pycacert.cer
+ OCSP - URI:http://testca.pythontest.net/testca/ocsp/
+
+ X509v3 CRL Distribution Points:
+
+ Full Name:
+ URI:http://testca.pythontest.net/testca/revocation.crl
+
+ Signature Algorithm: sha256WithRSAEncryption
+ 29:d2:3f:82:3f:c1:38:35:a6:bd:81:10:fe:64:ec:ff:7e:e1:
+ c6:6f:7f:86:65:f9:31:6f:fb:ef:32:4e:2f:87:c8:42:de:6c:
+ 8d:b8:06:08:8f:37:70:95:7d:e1:40:d4:82:2b:8d:b3:4a:fd:
+ 34:c5:9e:df:ff:01:53:4a:4f:08:f4:58:e1:74:fc:78:e3:3e:
+ 71:a7:5e:66:07:ea:d2:04:31:e2:75:a8:4c:80:17:86:92:20:
+ d2:32:a7:9a:65:8b:1a:5f:f1:4c:c8:50:6d:00:fc:99:bf:69:
+ b3:48:f3:45:5a:ee:35:50:14:b8:f3:92:92:c6:9f:0e:5d:eb:
+ 0d:e8:ec:f2:a4:09:6b:dc:66:2b:fc:df:4c:fc:65:a1:ae:d3:
+ b5:88:6a:a4:e7:08:1c:94:49:e0:b8:c1:04:8c:21:09:6c:55:
+ 4b:2c:97:10:f1:8c:6c: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Zl+TFv++8yTi+HyELebI24BgiPN3CVfeFA1IIrjbNK
+/TTFnt//AVNKTwj0WOF0/HjjPnGnXmYH6tIEMeJ1qEyAF4aSINIyp5plixpf8UzI
+UG0A/Jm/abNI80Va7jVQFLjzkpLGnw5d6w3o7PKkCWvcZiv830z8ZaGu07WIaqTn
+CByUSeC4wQSMIQlsVUsslxDxjGzQu7qNk+hHi02OfX2FUxjI+PSPZzqxqj4YNGw6
+5qbHL76DOPXV5dIXKGFstkmZIWmkqLaUdv0YrTVSRWT78V2Ou8AhLllVJK+7j7IK
+exfwNJeOaKny0D72c4L4fE6acH3Ws4zMhQRcAo902og6IKh+wp6w3VYfzs1CFsYU
+ka0w4Nx28ixW6jhF2MA+uJD68ziZ7EQHNY9pYgz577ed5RVCbvv+TP/olFoasICy
+Dhc94YeoCISTdGiNKd/KC2pEMopRO9Y4273jKhteIEiBghmRxoeMD81R6g==
-----END CERTIFICATE-----
diff --git a/Lib/test/make_ssl_certs.py b/Lib/test/make_ssl_certs.py
index a1f298de34975..41b5f46c882ca 100644
--- a/Lib/test/make_ssl_certs.py
+++ b/Lib/test/make_ssl_certs.py
@@ -2,15 +2,17 @@
and friends."""
import os
+import pprint
import shutil
-import sys
import tempfile
from subprocess import *
req_template = """
+ [ default ]
+ base_url = http://testca.pythontest.net/testca
+
[req]
distinguished_name = req_distinguished_name
- x509_extensions = req_x509_extensions
prompt = no
[req_distinguished_name]
@@ -19,8 +21,25 @@
O = Python Software Foundation
CN = {hostname}
- [req_x509_extensions]
+ [req_x509_extensions_simple]
+ subjectAltName = @san
+
+ [req_x509_extensions_full]
subjectAltName = @san
+ keyUsage = critical,keyEncipherment,digitalSignature
+ extendedKeyUsage = serverAuth,clientAuth
+ basicConstraints = critical,CA:false
+ subjectKeyIdentifier = hash
+ authorityKeyIdentifier = keyid:always,issuer:always
+ authorityInfoAccess = @issuer_ocsp_info
+ crlDistributionPoints = @crl_info
+
+ [ issuer_ocsp_info ]
+ caIssuers;URI.0 = $base_url/pycacert.cer
+ OCSP;URI.0 = $base_url/ocsp/
+
+ [ crl_info ]
+ URI.0 = $base_url/revocation.crl
[san]
DNS.1 = {hostname}
@@ -50,14 +69,13 @@
dir = cadir
database = $dir/index.txt
crlnumber = $dir/crl.txt
- default_md = sha1
+ default_md = sha256
default_days = 3600
default_crl_days = 3600
certificate = pycacert.pem
private_key = pycakey.pem
serial = $dir/serial
RANDFILE = $dir/.rand
-
policy = policy_match
[ policy_match ]
@@ -88,7 +106,9 @@
here = os.path.abspath(os.path.dirname(__file__))
-def make_cert_key(hostname, sign=False, extra_san=''):
+
+def make_cert_key(hostname, sign=False, extra_san='',
+ ext='req_x509_extensions_full', key='rsa:3072'):
print("creating cert for " + hostname)
tempnames = []
for i in range(3):
@@ -100,7 +120,8 @@ def make_cert_key(hostname, sign=False, extra_san=''):
with open(req_file, 'w') as f:
f.write(req)
args = ['req', '-new', '-days', '3650', '-nodes',
- '-newkey', 'rsa:1024', '-keyout', key_file,
+ '-newkey', key, '-keyout', key_file,
+ '-extensions', ext,
'-config', req_file]
if sign:
with tempfile.NamedTemporaryFile(delete=False) as f:
@@ -113,8 +134,15 @@ def make_cert_key(hostname, sign=False, extra_san=''):
check_call(['openssl'] + args)
if sign:
- args = ['ca', '-config', req_file, '-out', cert_file, '-outdir', 'cadir',
- '-policy', 'policy_anything', '-batch', '-infiles', reqfile ]
+ args = [
+ 'ca',
+ '-config', req_file,
+ '-extensions', ext,
+ '-out', cert_file,
+ '-outdir', 'cadir',
+ '-policy', 'policy_anything',
+ '-batch', '-infiles', reqfile
+ ]
check_call(['openssl'] + args)
@@ -146,7 +174,7 @@ def make_ca():
t.flush()
with tempfile.NamedTemporaryFile() as f:
args = ['req', '-new', '-days', '3650', '-extensions', 'v3_ca', '-nodes',
- '-newkey', 'rsa:2048', '-keyout', 'pycakey.pem',
+ '-newkey', 'rsa:3072', '-keyout', 'pycakey.pem',
'-out', f.name,
'-subj', '/C=XY/L=Castle Anthrax/O=Python Software Foundation CA/CN=our-ca-server']
check_call(['openssl'] + args)
@@ -158,16 +186,28 @@ def make_ca():
args = ['ca', '-config', t.name, '-gencrl', '-out', 'revocation.crl']
check_call(['openssl'] + args)
+ # capath hashes depend on subject!
+ check_call([
+ 'openssl', 'x509', '-in', 'pycacert.pem', '-out', 'capath/ceff1710.0'
+ ])
+ shutil.copy('capath/ceff1710.0', 'capath/b1930218.0')
+
+
+def print_cert(path):
+ import _ssl
+ pprint.pprint(_ssl._test_decode_cert(path))
+
+
if __name__ == '__main__':
os.chdir(here)
- cert, key = make_cert_key('localhost')
+ cert, key = make_cert_key('localhost', ext='req_x509_extensions_simple')
with open('ssl_cert.pem', 'w') as f:
f.write(cert)
with open('ssl_key.pem', 'w') as f:
f.write(key)
print("password protecting ssl_key.pem in ssl_key.passwd.pem")
- check_call(['openssl','rsa','-in','ssl_key.pem','-out','ssl_key.passwd.pem','-des3','-passout','pass:somepass'])
- check_call(['openssl','rsa','-in','ssl_key.pem','-out','keycert.passwd.pem','-des3','-passout','pass:somepass'])
+ check_call(['openssl','pkey','-in','ssl_key.pem','-out','ssl_key.passwd.pem','-aes256','-passout','pass:somepass'])
+ check_call(['openssl','pkey','-in','ssl_key.pem','-out','keycert.passwd.pem','-aes256','-passout','pass:somepass'])
with open('keycert.pem', 'w') as f:
f.write(key)
@@ -178,7 +218,7 @@ def make_ca():
# For certificate matching tests
make_ca()
- cert, key = make_cert_key('fakehostname')
+ cert, key = make_cert_key('fakehostname', ext='req_x509_extensions_simple')
with open('keycert2.pem', 'w') as f:
f.write(key)
f.write(cert)
@@ -193,6 +233,13 @@ def make_ca():
f.write(key)
f.write(cert)
+ cert, key = make_cert_key(
+ 'localhost-ecc', True, key='param:secp384r1.pem'
+ )
+ with open('keycertecc.pem', 'w') as f:
+ f.write(key)
+ f.write(cert)
+
extra_san = [
'otherName.1 = 1.2.3.4;UTF8:some other identifier',
'otherName.2 = 1.3.6.1.5.2.2;SEQUENCE:princ_name',
@@ -212,6 +259,24 @@ def make_ca():
f.write(key)
f.write(cert)
+ extra_san = [
+ # könig (king)
+ 'DNS.2 = xn--knig-5qa.idn.pythontest.net',
+ # königsgäßchen (king's alleyway)
+ 'DNS.3 = xn--knigsgsschen-lcb0w.idna2003.pythontest.net',
+ 'DNS.4 = xn--knigsgchen-b4a3dun.idna2008.pythontest.net',
+ # βόλοσ (marble)
+ 'DNS.5 = xn--nxasmq6b.idna2003.pythontest.net',
+ 'DNS.6 = xn--nxasmm1c.idna2008.pythontest.net',
+ ]
+
+ # IDN SANS, signed
+ cert, key = make_cert_key('idnsans', True, extra_san='\n'.join(extra_san))
+ with open('idnsans.pem', 'w') as f:
+ f.write(key)
+ f.write(cert)
+
unmake_ca()
- print("\n\nPlease change the values in test_ssl.py, test_parse_cert function related to notAfter,notBefore and serialNumber")
- check_call(['openssl','x509','-in','keycert.pem','-dates','-serial','-noout'])
+ print("update Lib/test/test_ssl.py and Lib/test/test_asyncio/util.py")
+ print_cert('keycert.pem')
+ print_cert('keycert3.pem')
diff --git a/Lib/test/pycacert.pem b/Lib/test/pycacert.pem
index 09b1f3e08aee6..73150c960f358 100644
--- a/Lib/test/pycacert.pem
+++ b/Lib/test/pycacert.pem
@@ -1,78 +1,99 @@
Certificate:
Data:
Version: 3 (0x2)
- Serial Number: 12723342612721443280 (0xb09264b1f2da21d0)
- Signature Algorithm: sha1WithRSAEncryption
+ Serial Number:
+ cb:2d:80:99:5a:69:52:5b
+ Signature Algorithm: sha256WithRSAEncryption
Issuer: C=XY, O=Python Software Foundation CA, CN=our-ca-server
Validity
- Not Before: Jan 4 19:47:07 2013 GMT
- Not After : Jan 2 19:47:07 2023 GMT
+ Not Before: Aug 29 14:23:16 2018 GMT
+ Not After : Aug 26 14:23:16 2028 GMT
Subject: C=XY, O=Python Software Foundation CA, CN=our-ca-server
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
- Public-Key: (2048 bit)
+ Public-Key: (3072 bit)
Modulus:
- 00:e7:de:e9:e3:0c:9f:00:b6:a1:fd:2b:5b:96:d2:
- 6f:cc:e0:be:86:b9:20:5e:ec:03:7a:55:ab:ea:a4:
- e9:f9:49:85:d2:66:d5:ed:c7:7a:ea:56:8e:2d:8f:
- e7:42:e2:62:28:a9:9f:d6:1b:8e:eb:b5:b4:9c:9f:
- 14:ab:df:e6:94:8b:76:1d:3e:6d:24:61:ed:0c:bf:
- 00:8a:61:0c:df:5c:c8:36:73:16:00:cd:47:ba:6d:
- a4:a4:74:88:83:23:0a:19:fc:09:a7:3c:4a:4b:d3:
- e7:1d:2d:e4:ea:4c:54:21:f3:26:db:89:37:18:d4:
- 02:bb:40:32:5f:a4:ff:2d:1c:f7:d4:bb:ec:8e:cf:
- 5c:82:ac:e6:7c:08:6c:48:85:61:07:7f:25:e0:5c:
- e0:bc:34:5f:e0:b9:04:47:75:c8:47:0b:8d:bc:d6:
- c8:68:5f:33:83:62:d2:20:44:35:b1:ad:81:1a:8a:
- cd:bc:35:b0:5c:8b:47:d6:18:e9:9c:18:97:cc:01:
- 3c:29:cc:e8:1e:e4:e4:c1:b8:de:e7:c2:11:18:87:
- 5a:93:34:d8:a6:25:f7:14:71:eb:e4:21:a2:d2:0f:
- 2e:2e:d4:62:00:35:d3:d6:ef:5c:60:4b:4c:a9:14:
- e2:dd:15:58:46:37:33:26:b7:e7:2e:5d:ed:42:e4:
- c5:4d
+ 00:97:ed:55:41:ba:36:17:95:db:71:1c:d3:e1:61:
+ ac:58:73:e3:c6:96:cf:2b:1f:b8:08:f5:9d:4b:4b:
+ c7:30:f6:b8:0b:b3:52:72:a0:bb:c9:4d:3b:8e:df:
+ 22:8e:01:57:81:c9:92:73:cc:00:c6:ec:70:b0:3a:
+ 17:40:c1:df:f2:8c:36:4c:c4:a7:81:e7:b6:24:68:
+ e2:a0:7e:35:07:2f:a0:5b:f9:45:46:f7:1e:f0:46:
+ 11:fe:ca:1a:3c:50:f1:26:a9:5f:9c:22:9c:f8:41:
+ e1:df:4f:12:95:19:2f:5c:90:01:17:6e:7e:3e:7d:
+ cf:e9:09:af:25:f8:f8:42:77:2d:6d:5f:36:f2:78:
+ 1e:7d:4a:87:68:63:6c:06:71:1b:8d:fa:25:fe:d4:
+ d3:f5:a5:17:b1:ef:ea:17:cb:54:c8:27:99:80:cb:
+ 3c:45:f1:2c:52:1c:dd:1f:51:45:20:50:1e:5e:ab:
+ 57:73:1b:41:78:96:de:84:a4:7a:dd:8f:30:85:36:
+ 58:79:76:a0:d2:61:c8:1b:a9:94:99:63:c6:ee:f8:
+ 14:bf:b4:52:56:31:97:fa:eb:ac:53:9e:95:ce:4c:
+ c4:5a:4a:b7:ca:03:27:5b:35:57:ce:02:dc:ec:ca:
+ 69:f8:8a:5a:39:cb:16:20:15:03:24:61:6c:f4:7a:
+ fc:b6:48:e5:59:10:5c:49:d0:23:9f:fb:71:5e:3a:
+ e9:68:9f:34:72:80:27:b6:3f:4c:b1:d9:db:63:7f:
+ 67:68:4a:6e:11:f8:e8:c0:f4:5a:16:39:53:0b:68:
+ de:77:fa:45:e7:f8:91:cd:78:cd:28:94:97:71:54:
+ fb:cf:f0:37:de:c9:26:c5:dc:1b:9e:89:6d:09:ac:
+ c8:44:71:cb:6d:f1:97:31:d5:4c:20:33:bf:75:4a:
+ a0:e0:dc:69:11:ed:2a:b4:64:10:11:30:8b:0e:b0:
+ a7:10:d8:8a:c5:aa:1b:c8:26:8a:25:e7:66:9f:a5:
+ 6a:1a:2f:7c:5f:83:c6:78:4f:1f
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Subject Key Identifier:
- BC:DD:62:D9:76:DA:1B:D2:54:6B:CF:E0:66:9B:1E:1E:7B:56:0C:0B
+ DD:BF:CA:DA:E6:D1:34:BA:37:75:21:CA:6F:9A:08:28:F2:35:B6:48
X509v3 Authority Key Identifier:
- keyid:BC:DD:62:D9:76:DA:1B:D2:54:6B:CF:E0:66:9B:1E:1E:7B:56:0C:0B
+ keyid:DD:BF:CA:DA:E6:D1:34:BA:37:75:21:CA:6F:9A:08:28:F2:35:B6:48
X509v3 Basic Constraints:
CA:TRUE
- Signature Algorithm: sha1WithRSAEncryption
- 7d:0a:f5:cb:8d:d3:5d:bd:99:8e:f8:2b:0f:ba:eb:c2:d9:a6:
- 27:4f:2e:7b:2f:0e:64:d8:1c:35:50:4e:ee:fc:90:b9:8d:6d:
- a8:c5:c6:06:b0:af:f3:2d:bf:3b:b8:42:07:dd:18:7d:6d:95:
- 54:57:85:18:60:47:2f:eb:78:1b:f9:e8:17:fd:5a:0d:87:17:
- 28:ac:4c:6a:e6:bc:29:f4:f4:55:70:29:42:de:85:ea:ab:6c:
- 23:06:64:30:75:02:8e:53:bc:5e:01:33:37:cc:1e:cd:b8:a4:
- fd:ca:e4:5f:65:3b:83:1c:86:f1:55:02:a0:3a:8f:db:91:b7:
- 40:14:b4:e7:8d:d2:ee:73:ba:e3:e5:34:2d:bc:94:6f:4e:24:
- 06:f7:5f:8b:0e:a7:8e:6b:de:5e:75:f4:32:9a:50:b1:44:33:
- 9a:d0:05:e2:78:82:ff:db:da:8a:63:eb:a9:dd:d1:bf:a0:61:
- ad:e3:9e:8a:24:5d:62:0e:e7:4c:91:7f:ef:df:34:36:3b:2f:
- 5d:f5:84:b2:2f:c4:6d:93:96:1a:6f:30:28:f1:da:12:9a:64:
- b4:40:33:1d:bd:de:2b:53:a8:ea:be:d6:bc:4e:96:f5:44:fb:
- 32:18:ae:d5:1f:f6:69:af:b6:4e:7b:1d:58:ec:3b:a9:53:a3:
- 5e:58:c8:9e
+ Signature Algorithm: sha256WithRSAEncryption
+ 33:6a:54:d3:6b:c0:d7:01:5f:9d:f4:05:c1:93:66:90:50:d0:
+ b7:18:e9:b0:1e:4a:a0:b6:da:76:93:af:84:db:ad:15:54:31:
+ 15:13:e4:de:7e:4e:0c:d5:09:1c:34:35:b6:e5:4c:d6:6f:65:
+ 7d:32:5f:eb:fc:a9:6b:07:f7:49:82:e5:81:7e:07:80:9a:63:
+ f8:2c:c3:40:bc:8f:d4:2a:da:3e:d1:ee:08:b7:4d:a7:84:ca:
+ f4:3f:a1:98:45:be:b1:05:69:e7:df:d7:99:ab:1b:ee:8b:30:
+ cc:f7:fc:e7:d4:0b:17:ae:97:bf:e4:7b:fd:0f:a7:b4:85:79:
+ e3:59:e2:16:87:bf:1f:29:45:2c:23:93:76:be:c0:87:1d:de:
+ ec:2b:42:6a:e5:bb:c8:f4:0a:4a:08:0a:8c:5c:d8:7d:4d:d1:
+ b8:bf:d5:f7:29:ed:92:d1:94:04:e8:35:06:57:7f:2c:23:97:
+ 87:a5:35:8d:26:d3:1a:47:f2:16:d7:d9:c6:d4:1f:23:43:d3:
+ 26:99:39:ca:20:f4:71:23:6f:0c:4a:76:76:f7:76:1f:b3:fe:
+ bf:47:b0:fc:2a:56:81:e1:d2:dd:ee:08:d8:f4:ff:5a:dc:25:
+ 61:8a:91:02:b9:86:1c:f2:50:73:76:25:35:fc:b6:25:26:15:
+ cb:eb:c4:2b:61:0c:1c:e7:ee:2f:17:9b:ec:f0:d4:a1:84:e7:
+ d2:af:de:e4:1b:24:14:a7:01:87:e3:ab:29:58:46:a0:d9:c0:
+ 0a:e0:8d:d7:59:d3:1b:f8:54:20:3e:78:a5:a5:c8:4f:8b:03:
+ c4:96:9f:ec:fb:47:cf:76:2d:8d:65:34:27:bf:fa:ae:01:05:
+ 8a:f3:92:0a:dd:89:6c:97:a1:c7:e7:60:51:e7:ac:eb:4b:7d:
+ 2c:b8:65:c9:fe:5d:6a:48:55:8e:e4:c7:f9:6a:40:e1:b8:64:
+ 45:e9:b5:59:29:a5:5f:cf:7d:58:7d:64:79:e5:a4:09:ac:1e:
+ 76:65:3d:94:c4:68
-----BEGIN CERTIFICATE-----
-MIIDbTCCAlWgAwIBAgIJALCSZLHy2iHQMA0GCSqGSIb3DQEBBQUAME0xCzAJBgNV
+MIIEbTCCAtWgAwIBAgIJAMstgJlaaVJbMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNV
BAYTAlhZMSYwJAYDVQQKDB1QeXRob24gU29mdHd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Vp59/Xmasb7oswzPf8
+59QLF66Xv+R7/Q+ntIV541niFoe/HylFLCOTdr7Ahx3e7CtCauW7yPQKSggKjFzY
+fU3RuL/V9yntktGUBOg1Bld/LCOXh6U1jSbTGkfyFtfZxtQfI0PTJpk5yiD0cSNv
+DEp2dvd2H7P+v0ew/CpWgeHS3e4I2PT/WtwlYYqRArmGHPJQc3YlNfy2JSYVy+vE
+K2EMHOfuLxeb7PDUoYTn0q/e5BskFKcBh+OrKVhGoNnACuCN11nTG/hUID54paXI
+T4sDxJaf7PtHz3YtjWU0J7/6rgEFivOSCt2JbJehx+dgUees60t9LLhlyf5dakhV
+juTH+WpA4bhkRem1WSmlX899WH1keeWkCawedmU9lMRo
-----END CERTIFICATE-----
diff --git a/Lib/test/pycakey.pem b/Lib/test/pycakey.pem
index fc6effefb2104..c283f89098684 100644
--- a/Lib/test/pycakey.pem
+++ b/Lib/test/pycakey.pem
@@ -1,28 +1,40 @@
-----BEGIN PRIVATE KEY-----
-MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDn3unjDJ8AtqH9
-K1uW0m/M4L6GuSBe7AN6VavqpOn5SYXSZtXtx3rqVo4tj+dC4mIoqZ/WG47rtbSc
-nxSr3+aUi3YdPm0kYe0MvwCKYQzfXMg2cxYAzUe6baSkdIiDIwoZ/AmnPEpL0+cd
-LeTqTFQh8ybbiTcY1AK7QDJfpP8tHPfUu+yOz1yCrOZ8CGxIhWEHfyXgXOC8NF/g
-uQRHdchHC4281shoXzODYtIgRDWxrYEais28NbBci0fWGOmcGJfMATwpzOge5OTB
-uN7nwhEYh1qTNNimJfcUcevkIaLSDy4u1GIANdPW71xgS0ypFOLdFVhGNzMmt+cu
-Xe1C5MVNAgMBAAECggEBAJPM7QuUrPn4cLN/Ysd15lwTWn9oHDFFgkYFvCs66gXE
-ju/6Kx2BjWE4wTJby09AHM/MqB0DvguT7Mf1Q2j3tPQ1HZowg8OwRDleuwp6KIls
-jBbhL0Jdl/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w
+d8b1P2BVHLRLJybA2Zr0ZqMfi+sfn/570pNjDXml8VG8FoQq+0jCGXVAOofFR7ay
+bDK9L4zADjBe4IcUHQKBwFwj8TEVlWxtG+IWO5d+vyuP0OPjSYOmYq4dCMyZ2+Xy
+Y+XDYEhlgGTVxafRMTwt57VV3hJTtRxUZziDA++atr8+gPio+QHBYg1JgCKsqKYL
+TGoSVrM1jTfdl1orwkpgQmq2q5j7ExpNA3Spsm5kyCaJ1S/8Ivusqaod8S4t7UhW
+BRec3gQ+UYv/V3Pc9hS1Zdzf5+G+PDOYoNmveY16hcu0DKc/PlqGtJuBoQjjH7ir
+1YVK9GAgLk0VqJvePnF57A==
-----END PRIVATE KEY-----
diff --git a/Lib/test/revocation.crl b/Lib/test/revocation.crl
index 6d89b08ebea20..c05461ca7f938 100644
--- a/Lib/test/revocation.crl
+++ b/Lib/test/revocation.crl
@@ -1,11 +1,14 @@
-----BEGIN X509 CRL-----
-MIIBpjCBjwIBATANBgkqhkiG9w0BAQUFADBNMQswCQYDVQQGEwJYWTEmMCQGA1UE
+MIICJjCBjwIBATANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQGEwJYWTEmMCQGA1UE
CgwdUHl0aG9uIFNvZnR3YXJlIEZvdW5kYXRpb24gQ0ExFjAUBgNVBAMMDW91ci1j
-YS1zZXJ2ZXIXDTEzMTEyMTE3MDg0N1oXDTIzMDkzMDE3MDg0N1qgDjAMMAoGA1Ud
-FAQDAgEAMA0GCSqGSIb3DQEBBQUAA4IBAQCNJXC2mVKauEeN3LlQ3ZtM5gkH3ExH
-+i4bmJjtJn497WwvvoIeUdrmVXgJQR93RtV37hZwN0SXMLlNmUZPH4rHhihayw4m
-unCzVj/OhCCY7/TPjKuJ1O/0XhaLBpBVjQN7R/1ujoRKbSia/CD3vcn7Fqxzw7LK
-fSRCKRGTj1CZiuxrphtFchwALXSiFDy9mr2ZKhImcyq1PydfgEzU78APpOkMQsIC
-UNJ/cf3c9emzf+dUtcMEcejQ3mynBo4eIGg1EW42bz4q4hSjzQlKcBV0muw5qXhc
-HOxH2iTFhQ7SrvVuK/dM14rYM4B5mSX3nRC1kNmXpS9j3wJDhuwmjHed
+YS1zZXJ2ZXIXDTE4MDgyOTE0MjMxNloXDTI4MDcwNzE0MjMxNlqgDjAMMAoGA1Ud
+FAQDAgEAMA0GCSqGSIb3DQEBCwUAA4IBgQCPhrtGSbuvxPAI3YWQFDB4iOWdBnVk
+ugW1lsifmCsE86FfID0EwUut1SRHlksltMtcoULMEIdu8yMLWci++4ve22EEuMKT
+HUc3T/wBIuQUhA7U4deFG8CZPAxRpNoK470y7dkD4OVf0Gxa6WYDl9z8mXKmWCB9
+hvzqVfLWNSLTAVPsHtkD5PXdi5yRkQr6wYD7poWaIvkpsn7EKCY6Tw5V3rsbRuZq
+AGVCq5TH3mctcmwLloCJ4Xr/1q0DsRrYxeeLYxE+UpvvCbVBKgtjBK7zINS7AbcJ
+CYCYKUwGWv1fYKJ+KQQHf75mT3jQ9lWuzOj/YWK4k1EBnYmVGuKKt73lLFxC6h3y
+MUnaBZc1KZSyJj0IxfHg/o6qx8NgKOl9XRIQ5g5B30cwpPOskGhEhodbTTY3bPtm
+RQ36JvQZngzmkhyhr+MDEV5yUTOShfUiclzQOx26CmLmLHWxOZgXtFZob/oKrvbm
+Gen/+7K7YTw6hfY52U7J2FuQRGOyzBXfBYQ=
-----END X509 CRL-----
diff --git a/Lib/test/ssl_cert.pem b/Lib/test/ssl_cert.pem
index 47a7d7e37e809..de596717bd855 100644
--- a/Lib/test/ssl_cert.pem
+++ b/Lib/test/ssl_cert.pem
@@ -1,15 +1,26 @@
-----BEGIN CERTIFICATE-----
-MIICVDCCAb2gAwIBAgIJANfHOBkZr8JOMA0GCSqGSIb3DQEBBQUAMF8xCzAJBgNV
-BAYTAlhZMRcwFQYDVQQHEw5DYXN0bGUgQW50aHJheDEjMCEGA1UEChMaUHl0aG9u
-IFNvZnR3YXJlIEZvdW5kYXRpb24xEjAQBgNVBAMTCWx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8OmH2MKOx4Nxlly5TNW
+HcVKQHyOeyvnINuBAQ==
-----END CERTIFICATE-----
diff --git a/Lib/test/ssl_key.passwd.pem b/Lib/test/ssl_key.passwd.pem
index 2524672e70d19..46de61ab85b13 100644
--- a/Lib/test/ssl_key.passwd.pem
+++ b/Lib/test/ssl_key.passwd.pem
@@ -1,18 +1,42 @@
------BEGIN RSA PRIVATE KEY-----
-Proc-Type: 4,ENCRYPTED
-DEK-Info: DES-EDE3-CBC,1A8D9D2A02EC698A
-
-kJYbfZ8L0sfe9Oty3gw0aloNnY5E8fegRfQLZlNoxTl6jNt0nIwI8kDJ36CZgR9c
-u3FDJm/KqrfUoz8vW+qEnWhSG7QPX2wWGPHd4K94Yz/FgrRzZ0DoK7XxXq9gOtVA
-AVGQhnz32p+6WhfGsCr9ArXEwRZrTk/FvzEPaU5fHcoSkrNVAGX8IpSVkSDwEDQr
-Gv17+cfk99UV1OCza6yKHoFkTtrC+PZU71LomBabivS2Oc4B9hYuSR2hF01wTHP+
-YlWNagZOOVtNz4oKK9x9eNQpmfQXQvPPTfusexKIbKfZrMvJoxcm1gfcZ0H/wK6P
-6wmXSG35qMOOztCZNtperjs1wzEBXznyK8QmLcAJBjkfarABJX9vBEzZV0OUKhy+
-noORFwHTllphbmydLhu6ehLUZMHPhzAS5UN7srtpSN81eerDMy0RMUAwA7/PofX1
-94Me85Q8jP0PC9ETdsJcPqLzAPETEYu0ELewKRcrdyWi+tlLFrpE5KT/s5ecbl9l
-7B61U4Kfd1PIXc/siINhU3A3bYK+845YyUArUOnKf1kEox7p1RpD7yFqVT04lRTo
-cibNKATBusXSuBrp2G6GNuhWEOSafWCKJQAzgCYIp6ZTV2khhMUGppc/2H3CF6cO
-zX0KtlPVZC7hLkB6HT8SxYUwF1zqWY7+/XPPdc37MeEZ87Q3UuZwqORLY+Z0hpgt
-L5JXBCoklZhCAaN2GqwFLXtGiRSRFGY7xXIhbDTlE65Wv1WGGgDLMKGE1gOz3yAo
-2jjG1+yAHJ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+KrdBDrupv/XAgEOclmgToY3iywLJSV5gHAyHWDUhRH4cFCLiGPl4XIcnXOuTze3H
+3j+EYSiS3v3DhHjp33YU2pXlJDjiYsKzAXejEh66++Y8qaQdCAad3ruWRCzW3kgk
+Md0A1VGzntTnQsewvExQEMZH2LtYIsPv3KCYGeSAuLabX4tbGk79PswjnjLLEOr0
+Ghf6RF6qf5/iFyJoG4vrbKT8kx6ywh0InILCdjUunuDskIBxX6tEcr9XwajoIvb2
+kcmGdjam5kKLS7QOWQTl8/r/cuFes0dj34cX5Qpq+Gd7tRq/D+b0207926Cxvftv
+qQ1cVn8HiLxKkZzd3tpf2xnoV1zkTL0oHrNg+qzxoxXUTUcwtIf1d/HRbYEAhi/d
+bBBoFeftEHWNq+sJgS9bH+XNzo/yK4u04B5miOq8v4CSkJdzu+ZdF22d4cjiGmtQ
+8BTmcn0Unzm+u5H0+QSZe54QBHJGNXXOIKMTkgnOdW27g4DbI1y7fCqJiSMbRW6L
+oHmMfbdB3GWqGbsUkhY8i6h9op0MU6WOX7ea2Rxyt4t6
+-----END ENCRYPTED PRIVATE KEY-----
diff --git a/Lib/test/ssl_key.pem b/Lib/test/ssl_key.pem
index 3fd3bbd54a345..1ea4578d81ecc 100644
--- a/Lib/test/ssl_key.pem
+++ b/Lib/test/ssl_key.pem
@@ -1,16 +1,40 @@
-----BEGIN PRIVATE KEY-----
-MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBANtb0+YrKuxevGpm
-LrjaUhZSgz6zFAmuGFmKmUbdjmfv9zSmmdsQIksK++jK0Be9LeZy20j6ahOfuVa0
-ufEmPoP7Fy4hXegKZR9cCWcIe/A6H2xWF1IIJLRTLaU8ol/I7T+um5HD5AwAwNPP
-USNU0Eegmvp+xxWu3NX2m1Veot85AgMBAAECgYA3ZdZ673X0oexFlq7AAmrutkHt
-CL7LvwrpOiaBjhyTxTeSNWzvtQBkIU8DOI0bIazA4UreAFffwtvEuPmonDb3F+Iq
-SMAu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ZMJttd+Y7gTOYZcbg3SdRb/kdxYki0RMD2hF
+4ZvjJ6CTfwKBwQDiMqiZFTJGQwYqp4vWEmAW+I4r4xkUpWatoI2Fk5eI5T9+1PLX
+uYXsho56NxEU1UrOg4Cb/p+TcBc8PErkGqR0BkpxDMOInTOXSrQe6lxIBoECVXc3
+HTbrmiay0a5y5GfCgxPKqIJhfcToAceoVjovv0y7S4yoxGZKuUEe7E8JY2iqRNAO
+yOvKCCICv/hcN235E44RF+2/rDlOltagNej5tY6rIFkaDdgOF4bD7f9O5eEni1Bg
+litfoesDtQP/3rECgcEAkQfvQ7D6tIPmbqsbJBfCr6fmoqZllT4FIJN84b50+OL0
+mTGsfjdqC4tdhx3sdu7/VPbaIqm5NmX10bowWgWSY7MbVME4yQPyqSwC5NbIonEC
+d6N0mzoLR0kQ+Ai4u+2g82gicgAq2oj1uSNi3WZi48jQjHYFulCbo246o1NgeFFK
+77WshYe2R1ioQfQDOU1URKCR0uTaMHClgfu112yiGd12JAD+aF3TM0kxDXz+sXI5
+SKy311DFxECZeXRLpcC3AoHBAJkNMJWTyPYbeVu+CTQkec8Uun233EkXa2kUNZc/
+5DuXDaK+A3DMgYRufTKSPpDHGaCZ1SYPInX1Uoe2dgVjWssRL2uitR4ENabDoAOA
+ICVYXYYNagqQu5wwirF0QeaMXo1fjhuuHQh8GsMdXZvYEaAITZ9/NG5x/oY08+8H
+kr78SMBOPy3XQn964uKG+e3JwpOG14GKABdAlrHKFXNWchu/6dgcYXB87mrC/GhO
+zNwzC+QhFTZoOomFoqMgFWujng==
-----END PRIVATE KEY-----
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
index b23889b20dea7..66a3413b6970c 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -77,8 +77,8 @@ async def doit():
ONLYKEY = data_file('ssl_key.pem')
SIGNED_CERTFILE = data_file('keycert3.pem')
SIGNING_CA = data_file('pycacert.pem')
-PEERCERT = {'serialNumber': 'B09264B1F2DA21D1',
- 'version': 1,
+PEERCERT = {'serialNumber': 'CB2D80995A69525C',
+ 'version': 3,
'subject': ((('countryName', 'XY'),),
(('localityName', 'Castle Anthrax'),),
(('organizationName', 'Python Software Foundation'),),
@@ -86,8 +86,16 @@ async def doit():
'issuer': ((('countryName', 'XY'),),
(('organizationName', 'Python Software Foundation CA'),),
(('commonName', 'our-ca-server'),)),
- 'notAfter': 'Nov 13 19:47:07 2022 GMT',
- 'notBefore': 'Jan 4 19:47:07 2013 GMT'}
+ 'notAfter': 'Jul 7 14:23:16 2028 GMT',
+ 'notBefore': 'Aug 29 14:23:16 2018 GMT',
+ 'subjectAltName': (('DNS', 'localhost'),),
+ 'OCSP': ('http://testca.pythontest.net/testca/ocsp/',),
+ 'caIssuers': (
+ 'http://testca.pythontest.net/testca/pycacert.cer',
+ ),
+ 'crlDistributionPoints': (
+ 'http://testca.pythontest.net/testca/revocation.crl',
+ )}
class MyBaseProto(asyncio.Protocol):
@@ -1242,6 +1250,8 @@ def test_create_server_ssl_verified(self):
server.close()
self.loop.run_until_complete(proto.done)
+ maxDiff = None
+
def test_legacy_create_server_ssl_verified(self):
with test_utils.force_legacy_ssl_support():
self.test_create_server_ssl_verified()
diff --git a/Lib/test/test_ssl.py b/Lib/test/test_ssl.py
index 30a64ee0a4c7e..44c2725d2c2f7 100644
--- a/Lib/test/test_ssl.py
+++ b/Lib/test/test_ssl.py
@@ -228,9 +228,9 @@ def test_parse_cert(self):
(('commonName', 'localhost'),))
)
# Note the next three asserts will fail if the keys are regenerated
- self.assertEqual(p['notAfter'], asn1time('Oct 5 23:01:56 2020 GMT'))
- self.assertEqual(p['notBefore'], asn1time('Oct 8 23:01:56 2010 GMT'))
- self.assertEqual(p['serialNumber'], 'D7C7381919AFC24E')
+ self.assertEqual(p['notAfter'], asn1time('Aug 26 14:23:15 2028 GMT'))
+ self.assertEqual(p['notBefore'], asn1time('Aug 29 14:23:15 2018 GMT'))
+ self.assertEqual(p['serialNumber'], '98A7CF88C74A32ED')
self.assertEqual(p['subject'],
((('countryName', 'XY'),),
(('localityName', 'Castle Anthrax'),),
diff --git a/Misc/NEWS.d/next/Library/2020-07-01-16-59-46.bpo-41183.9stVAW.rst b/Misc/NEWS.d/next/Library/2020-07-01-16-59-46.bpo-41183.9stVAW.rst
new file mode 100644
index 0000000000000..1ca3c7d7996c1
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-07-01-16-59-46.bpo-41183.9stVAW.rst
@@ -0,0 +1 @@
+Use 3072 RSA keys and SHA-256 signature for test certs and keys.
1
0
[3.8] bpo-41043: Escape literal part of the path for glob(). (GH-20994). (GH-21277)
by Serhiy Storchaka July 2, 2020
by Serhiy Storchaka July 2, 2020
July 2, 2020
https://github.com/python/cpython/commit/e73896241e55f452656fd8070eb79f3440…
commit: e73896241e55f452656fd8070eb79f344091bca0
branch: 3.8
author: Serhiy Storchaka <storchaka(a)gmail.com>
committer: GitHub <noreply(a)github.com>
date: 2020-07-02T10:05:35+03:00
summary:
[3.8] bpo-41043: Escape literal part of the path for glob(). (GH-20994). (GH-21277)
(cherry picked from commit 935586845815f5b4c7814794413f6a812d4bd45f)
files:
A Misc/NEWS.d/next/Library/2020-06-20-00-19-30.bpo-41043.p-Pk-H.rst
M Lib/distutils/command/build_py.py
M Lib/idlelib/tree.py
M Lib/imghdr.py
M Lib/pdb.py
M Lib/sndhdr.py
M Lib/test/_test_multiprocessing.py
M Lib/test/libregrtest/main.py
M Lib/test/support/__init__.py
M Lib/test/test_bz2.py
M Lib/test/test_crashers.py
M Lib/test/test_dbm.py
M Lib/test/test_import/__init__.py
M Lib/test/test_mailbox.py
M Lib/test/test_regrtest.py
M Lib/test/test_site.py
M Lib/test/test_tokenize.py
M Lib/test/test_unicode_file.py
M Lib/webbrowser.py
M Tools/c-globals/check-c-globals.py
M Tools/ssl/make_ssl_data.py
M setup.py
diff --git a/Lib/distutils/command/build_py.py b/Lib/distutils/command/build_py.py
index cf0ca57c32047..edc2171cd122d 100644
--- a/Lib/distutils/command/build_py.py
+++ b/Lib/distutils/command/build_py.py
@@ -5,7 +5,7 @@
import os
import importlib.util
import sys
-from glob import glob
+import glob
from distutils.core import Command
from distutils.errors import *
@@ -125,7 +125,7 @@ def find_data_files(self, package, src_dir):
files = []
for pattern in globs:
# Each pattern has to be converted to a platform-specific path
- filelist = glob(os.path.join(src_dir, convert_path(pattern)))
+ filelist = glob.glob(os.path.join(glob.escape(src_dir), convert_path(pattern)))
# Files that match more than one pattern are only added once
files.extend([fn for fn in filelist if fn not in files
and os.path.isfile(fn)])
@@ -216,7 +216,7 @@ def check_module(self, module, module_file):
def find_package_modules(self, package, package_dir):
self.check_package(package, package_dir)
- module_files = glob(os.path.join(package_dir, "*.py"))
+ module_files = glob.glob(os.path.join(glob.escape(package_dir), "*.py"))
modules = []
setup_script = os.path.abspath(self.distribution.script_name)
diff --git a/Lib/idlelib/tree.py b/Lib/idlelib/tree.py
index 6229be4e5a8ad..5947268f5c35a 100644
--- a/Lib/idlelib/tree.py
+++ b/Lib/idlelib/tree.py
@@ -38,7 +38,7 @@ def listicons(icondir=ICONDIR):
"""Utility to display the available icons."""
root = Tk()
import glob
- list = glob.glob(os.path.join(icondir, "*.gif"))
+ list = glob.glob(os.path.join(glob.escape(icondir), "*.gif"))
list.sort()
images = []
row = column = 0
diff --git a/Lib/imghdr.py b/Lib/imghdr.py
index 76e8abb2d5833..6e01fd857469a 100644
--- a/Lib/imghdr.py
+++ b/Lib/imghdr.py
@@ -152,7 +152,7 @@ def testall(list, recursive, toplevel):
if recursive or toplevel:
print('recursing down:')
import glob
- names = glob.glob(os.path.join(filename, '*'))
+ names = glob.glob(os.path.join(glob.escape(filename), '*'))
testall(names, recursive, 0)
else:
print('*** directory (use -r) ***')
diff --git a/Lib/pdb.py b/Lib/pdb.py
index 931a039446187..081023526c0ea 100755
--- a/Lib/pdb.py
+++ b/Lib/pdb.py
@@ -474,7 +474,7 @@ def _complete_location(self, text, line, begidx, endidx):
except Exception:
ret = []
# Then, try to complete file names as well.
- globs = glob.glob(text + '*')
+ globs = glob.glob(glob.escape(text) + '*')
for fn in globs:
if os.path.isdir(fn):
ret.append(fn + '/')
diff --git a/Lib/sndhdr.py b/Lib/sndhdr.py
index 594353136f5c3..96595c6974468 100644
--- a/Lib/sndhdr.py
+++ b/Lib/sndhdr.py
@@ -241,7 +241,7 @@ def testall(list, recursive, toplevel):
if recursive or toplevel:
print('recursing down:')
import glob
- names = glob.glob(os.path.join(filename, '*'))
+ names = glob.glob(os.path.join(glob.escape(filename), '*'))
testall(names, recursive, 0)
else:
print('*** directory (use -r) ***')
diff --git a/Lib/test/_test_multiprocessing.py b/Lib/test/_test_multiprocessing.py
index 87f5044148fbe..8626aa37c186e 100644
--- a/Lib/test/_test_multiprocessing.py
+++ b/Lib/test/_test_multiprocessing.py
@@ -4222,7 +4222,7 @@ class _TestImportStar(unittest.TestCase):
def get_module_names(self):
import glob
folder = os.path.dirname(multiprocessing.__file__)
- pattern = os.path.join(folder, '*.py')
+ pattern = os.path.join(glob.escape(folder), '*.py')
files = glob.glob(pattern)
modules = [os.path.splitext(os.path.split(f)[1])[0] for f in files]
modules = ['multiprocessing.' + m for m in modules]
diff --git a/Lib/test/libregrtest/main.py b/Lib/test/libregrtest/main.py
index 95b4856c8bed7..adf31cc94940d 100644
--- a/Lib/test/libregrtest/main.py
+++ b/Lib/test/libregrtest/main.py
@@ -602,7 +602,7 @@ def create_temp_dir(self):
def cleanup(self):
import glob
- path = os.path.join(self.tmp_dir, 'test_python_*')
+ path = os.path.join(glob.escape(self.tmp_dir), 'test_python_*')
print("Cleanup %s directory" % self.tmp_dir)
for name in glob.glob(path):
if os.path.isdir(name):
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index 937766b8ce725..fb09e0623e590 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -2625,7 +2625,7 @@ def _platform_specific(self):
dll,
os.path.join(dest_dir, os.path.basename(dll))
))
- for runtime in glob.glob(os.path.join(src_dir, "vcruntime*.dll")):
+ for runtime in glob.glob(os.path.join(glob.escape(src_dir), "vcruntime*.dll")):
self._also_link.append((
runtime,
os.path.join(dest_dir, os.path.basename(runtime))
diff --git a/Lib/test/test_bz2.py b/Lib/test/test_bz2.py
index eb2f72ee4a5d3..2591f0a6ac40e 100644
--- a/Lib/test/test_bz2.py
+++ b/Lib/test/test_bz2.py
@@ -69,7 +69,7 @@ class BaseTest(unittest.TestCase):
# simply use the bigger test data for all tests.
test_size = 0
BIG_TEXT = bytearray(128*1024)
- for fname in glob.glob(os.path.join(os.path.dirname(__file__), '*.py')):
+ for fname in glob.glob(os.path.join(glob.escape(os.path.dirname(__file__)), '*.py')):
with open(fname, 'rb') as fh:
test_size += fh.readinto(memoryview(BIG_TEXT)[test_size:])
if test_size > 128*1024:
diff --git a/Lib/test/test_crashers.py b/Lib/test/test_crashers.py
index 58dfd001da362..31b712028f8a1 100644
--- a/Lib/test/test_crashers.py
+++ b/Lib/test/test_crashers.py
@@ -11,7 +11,7 @@
from test.support.script_helper import assert_python_failure
CRASHER_DIR = os.path.join(os.path.dirname(__file__), "crashers")
-CRASHER_FILES = os.path.join(CRASHER_DIR, "*.py")
+CRASHER_FILES = os.path.join(glob.escape(CRASHER_DIR), "*.py")
infinite_loops = ["infinite_loop_re.py", "nasty_eq_vs_dict.py"]
diff --git a/Lib/test/test_dbm.py b/Lib/test/test_dbm.py
index 1db3bef6f4136..571da973aab0e 100644
--- a/Lib/test/test_dbm.py
+++ b/Lib/test/test_dbm.py
@@ -33,7 +33,7 @@ def dbm_iterator():
def delete_files():
# we don't know the precise name the underlying database uses
# so we use glob to locate all names
- for f in glob.glob(_fname + "*"):
+ for f in glob.glob(glob.escape(_fname) + "*"):
test.support.unlink(f)
diff --git a/Lib/test/test_import/__init__.py b/Lib/test/test_import/__init__.py
index f037821dda2ce..52f0491679f35 100644
--- a/Lib/test/test_import/__init__.py
+++ b/Lib/test/test_import/__init__.py
@@ -478,7 +478,7 @@ def test_dll_dependency_import(self):
pyexe = os.path.join(tmp, os.path.basename(sys.executable))
shutil.copy(sys.executable, pyexe)
shutil.copy(dllname, tmp)
- for f in glob.glob(os.path.join(sys.prefix, "vcruntime*.dll")):
+ for f in glob.glob(os.path.join(glob.escape(sys.prefix), "vcruntime*.dll")):
shutil.copy(f, tmp)
shutil.copy(pydname, tmp2)
diff --git a/Lib/test/test_mailbox.py b/Lib/test/test_mailbox.py
index 0995b1e386d00..effac97d8f9a9 100644
--- a/Lib/test/test_mailbox.py
+++ b/Lib/test/test_mailbox.py
@@ -979,7 +979,7 @@ def tearDown(self):
super().tearDown()
self._box.close()
self._delete_recursively(self._path)
- for lock_remnant in glob.glob(self._path + '.*'):
+ for lock_remnant in glob.glob(glob.escape(self._path) + '.*'):
support.unlink(lock_remnant)
def assertMailboxEmpty(self):
@@ -1311,7 +1311,7 @@ def tearDown(self):
super().tearDown()
self._box.close()
self._delete_recursively(self._path)
- for lock_remnant in glob.glob(self._path + '.*'):
+ for lock_remnant in glob.glob(glob.escape(self._path) + '.*'):
support.unlink(lock_remnant)
def test_labels(self):
diff --git a/Lib/test/test_regrtest.py b/Lib/test/test_regrtest.py
index e2fa1977ba6c7..f89b1af7743fb 100644
--- a/Lib/test/test_regrtest.py
+++ b/Lib/test/test_regrtest.py
@@ -559,7 +559,7 @@ def test_finds_expected_number_of_tests(self):
args = ['-Wd', '-E', '-bb', '-m', 'test.regrtest', '--list-tests']
output = self.run_python(args)
rough_number_of_tests_found = len(output.splitlines())
- actual_testsuite_glob = os.path.join(os.path.dirname(__file__),
+ actual_testsuite_glob = os.path.join(glob.escape(os.path.dirname(__file__)),
'test*.py')
rough_counted_test_py_files = len(glob.glob(actual_testsuite_glob))
# We're not trying to duplicate test finding logic in here,
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index 1bbc6979368db..9a047fd4669d1 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -526,7 +526,7 @@ def test_startup_imports(self):
# found in sys.path (see site.addpackage()). Skip the test if at least
# one .pth file is found.
for path in isolated_paths:
- pth_files = glob.glob(os.path.join(path, "*.pth"))
+ pth_files = glob.glob(os.path.join(glob.escape(path), "*.pth"))
if pth_files:
self.skipTest(f"found {len(pth_files)} .pth files in: {path}")
diff --git a/Lib/test/test_tokenize.py b/Lib/test/test_tokenize.py
index 4c90092893a22..6de7aa87bb2f9 100644
--- a/Lib/test/test_tokenize.py
+++ b/Lib/test/test_tokenize.py
@@ -1605,7 +1605,7 @@ def test_random_files(self):
import glob, random
fn = support.findfile("tokenize_tests.txt")
tempdir = os.path.dirname(fn) or os.curdir
- testfiles = glob.glob(os.path.join(tempdir, "test*.py"))
+ testfiles = glob.glob(os.path.join(glob.escape(tempdir), "test*.py"))
# Tokenize is broken on test_pep3131.py because regular expressions are
# broken on the obscure unicode identifiers in it. *sigh*
diff --git a/Lib/test/test_unicode_file.py b/Lib/test/test_unicode_file.py
index b16e4c5b3bd61..e8feb42c6b0c2 100644
--- a/Lib/test/test_unicode_file.py
+++ b/Lib/test/test_unicode_file.py
@@ -40,7 +40,7 @@ def _do_single(self, filename):
self._do_copyish(filename, filename)
# Filename should appear in glob output
self.assertTrue(
- os.path.abspath(filename)==os.path.abspath(glob.glob(filename)[0]))
+ os.path.abspath(filename)==os.path.abspath(glob.glob(glob.escape(filename))[0]))
# basename should appear in listdir.
path, base = os.path.split(os.path.abspath(filename))
file_list = os.listdir(path)
diff --git a/Lib/webbrowser.py b/Lib/webbrowser.py
index 53e0efc967a0e..cea91308ce1b3 100755
--- a/Lib/webbrowser.py
+++ b/Lib/webbrowser.py
@@ -413,7 +413,7 @@ def _find_grail_rc(self):
tempdir = os.path.join(tempfile.gettempdir(),
".grail-unix")
user = pwd.getpwuid(os.getuid())[0]
- filename = os.path.join(tempdir, user + "-*")
+ filename = os.path.join(glob.escape(tempdir), glob.escape(user) + "-*")
maybes = glob.glob(filename)
if not maybes:
return None
diff --git a/Misc/NEWS.d/next/Library/2020-06-20-00-19-30.bpo-41043.p-Pk-H.rst b/Misc/NEWS.d/next/Library/2020-06-20-00-19-30.bpo-41043.p-Pk-H.rst
new file mode 100644
index 0000000000000..9c6020eb8d738
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2020-06-20-00-19-30.bpo-41043.p-Pk-H.rst
@@ -0,0 +1,2 @@
+Fixed the use of :func:`~glob.glob` in the stdlib: literal part of the path
+is now always correctly escaped.
diff --git a/Tools/c-globals/check-c-globals.py b/Tools/c-globals/check-c-globals.py
index e68ed9271fe48..1371f92742327 100644
--- a/Tools/c-globals/check-c-globals.py
+++ b/Tools/c-globals/check-c-globals.py
@@ -37,7 +37,9 @@
def find_capi_vars(root):
capi_vars = {}
for dirname in SOURCE_DIRS:
- for filename in glob.glob(os.path.join(ROOT_DIR, dirname, '**/*.[hc]'),
+ for filename in glob.glob(os.path.join(
+ glob.escape(os.path.join(ROOT_DIR, dirname)),
+ '**/*.[hc]'),
recursive=True):
with open(filename) as file:
for name in _find_capi_vars(file):
diff --git a/Tools/ssl/make_ssl_data.py b/Tools/ssl/make_ssl_data.py
index d60f352882e30..c39e38c5069d5 100755
--- a/Tools/ssl/make_ssl_data.py
+++ b/Tools/ssl/make_ssl_data.py
@@ -39,7 +39,7 @@ def parse_error_codes(h_file, prefix, libcode):
f = sys.stdout if use_stdout else open(outfile, "w")
# mnemonic -> (library code, error prefix, header file)
error_libraries = {}
- for error_header in glob.glob(os.path.join(openssl_inc, 'include/openssl/*err.h')):
+ for error_header in glob.glob(os.path.join(glob.escape(openssl_inc), 'include/openssl/*err.h')):
base = os.path.basename(error_header)
if base in ('buffererr.h', 'objectserr.h', 'storeerr.h'):
# Deprecated in 3.0.
diff --git a/setup.py b/setup.py
index b168ed4082fd3..6340669fffdff 100644
--- a/setup.py
+++ b/setup.py
@@ -8,7 +8,7 @@
import re
import sys
import sysconfig
-from glob import glob
+from glob import glob, escape
from distutils import log
from distutils.command.build_ext import build_ext
@@ -339,7 +339,7 @@ def build_extensions(self):
# Python header files
headers = [sysconfig.get_config_h_filename()]
- headers += glob(os.path.join(sysconfig.get_path('include'), "*.h"))
+ headers += glob(os.path.join(escape(sysconfig.get_path('include')), "*.h"))
# The sysconfig variables built by makesetup that list the already
# built modules and the disabled modules as configured by the Setup
@@ -2256,7 +2256,7 @@ def detect_hash_builtins(self):
self.add(Extension('_sha1', ['sha1module.c'],
depends=['hashlib.h']))
- blake2_deps = glob(os.path.join(self.srcdir,
+ blake2_deps = glob(os.path.join(escape(self.srcdir),
'Modules/_blake2/impl/*'))
blake2_deps.append('hashlib.h')
@@ -2266,7 +2266,7 @@ def detect_hash_builtins(self):
'_blake2/blake2s_impl.c'],
depends=blake2_deps))
- sha3_deps = glob(os.path.join(self.srcdir,
+ sha3_deps = glob(os.path.join(escape(self.srcdir),
'Modules/_sha3/kcp/*'))
sha3_deps.append('hashlib.h')
self.add(Extension('_sha3',
1
0
https://github.com/python/cpython/commit/cbdacb94c1a096387e1fb37d4e44bb3847…
commit: cbdacb94c1a096387e1fb37d4e44bb3847d0c4f8
branch: 3.8
author: Ned Deily <nad(a)python.org>
committer: GitHub <noreply(a)github.com>
date: 2020-07-02T01:58:31-04:00
summary:
3.8.3 -> 3.8.4 in macOS installer ReadMe (GH-21274)
files:
M Mac/BuildScript/resources/ReadMe.rtf
diff --git a/Mac/BuildScript/resources/ReadMe.rtf b/Mac/BuildScript/resources/ReadMe.rtf
index e09c5e97709d9..b1e972eec2d6e 100644
--- a/Mac/BuildScript/resources/ReadMe.rtf
+++ b/Mac/BuildScript/resources/ReadMe.rtf
@@ -56,11 +56,10 @@ macOS 10.15 (Catalina) Gatekeeper Requirements [changed in 3.8.2]\
As of 2020-02-03, Apple has changed how third-party installer packages, like those provided by python.org, are notarized for verification by Gatekeeper and begun enforcing additional requirements such as code signing and use of the hardened runtime. As of 3.8.2, python.org installer packages now meet those additional notarization requirements. The necessary changes in packaging should be transparent to your use of Python but, in the unlikely event that you encounter changes in behavior between 3.8.1 and newer 3.8.x releases in areas like ctypes, importlib, or mmap, please check bugs.python.org for existing reports and, if necessary, open a new issue.\
\f1\b \ul \
-Python 2.7 end-of-life [changed in 3.8.3]\
+Python 2.7 end-of-life [changed in 3.8.4]\
\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
-\f0\b0 \cf0 \ulnone Python 2.7 has now reached end-of-life. As of Python 3.8.3, the
+\f0\b0 \ulnone Python 2.7 has now reached end-of-life. As of Python 3.8.4, the
\f3 Python Launcher
\f0 app now has
\f3 python3
@@ -73,9 +72,8 @@ Python 2.7 end-of-life [changed in 3.8.3]\
\f0 . This change might affect developers using the framework to embed Python in their applications. If another version is desired for embedding, the
\f3 Current
\f0 symlink can be changed manually without affecting 3.8.x behavior.\
-\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural\partightenfactor0
-\f1\b \cf0 \ul \ulc0 \
+\f1\b \ul \
Other changes\
\f0\b0 \ulnone \
1
0