Issue #24098: Fixed possible crash when AST is changed in process of
compiling it.
This commit is contained in:
commit
5e80855af3
|
@ -10,6 +10,9 @@ What's New in Python 3.6.0 beta 2
|
|||
Core and Builtins
|
||||
-----------------
|
||||
|
||||
- Issue #24098: Fixed possible crash when AST is changed in process of
|
||||
compiling it.
|
||||
|
||||
- Issue #28201: Dict reduces possibility of 2nd conflict in hash table when
|
||||
hashes have same lower bits.
|
||||
|
||||
|
|
|
@ -526,6 +526,13 @@ class Obj2ModVisitor(PickleVisitor):
|
|||
self.emit("res = obj2ast_%s(PyList_GET_ITEM(tmp, i), &value, arena);" %
|
||||
field.type, depth+2, reflow=False)
|
||||
self.emit("if (res != 0) goto failed;", depth+2)
|
||||
self.emit("if (len != PyList_GET_SIZE(tmp)) {", depth+2)
|
||||
self.emit("PyErr_SetString(PyExc_RuntimeError, \"%s field \\\"%s\\\" "
|
||||
"changed size during iteration\");" %
|
||||
(name, field.name),
|
||||
depth+3, reflow=False)
|
||||
self.emit("goto failed;", depth+3)
|
||||
self.emit("}", depth+2)
|
||||
self.emit("asdl_seq_SET(%s, i, value);" % field.name, depth+2)
|
||||
self.emit("}", depth+1)
|
||||
else:
|
||||
|
|
|
@ -3997,6 +3997,10 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Module field \"body\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(body, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4032,6 +4036,10 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Interactive field \"body\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(body, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4089,6 +4097,10 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Suite field \"body\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(body, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4192,6 +4204,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "FunctionDef field \"body\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(body, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4216,6 +4232,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
expr_ty value;
|
||||
res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "FunctionDef field \"decorator_list\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(decorator_list, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4288,6 +4308,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "AsyncFunctionDef field \"body\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(body, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4312,6 +4336,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
expr_ty value;
|
||||
res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "AsyncFunctionDef field \"decorator_list\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(decorator_list, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4373,6 +4401,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
expr_ty value;
|
||||
res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"bases\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(bases, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4397,6 +4429,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
keyword_ty value;
|
||||
res = obj2ast_keyword(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"keywords\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(keywords, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4421,6 +4457,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"body\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(body, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4445,6 +4485,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
expr_ty value;
|
||||
res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "ClassDef field \"decorator_list\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(decorator_list, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4502,6 +4546,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
expr_ty value;
|
||||
res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Delete field \"targets\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(targets, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4538,6 +4586,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
expr_ty value;
|
||||
res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Assign field \"targets\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(targets, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4713,6 +4765,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "For field \"body\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(body, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4737,6 +4793,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "For field \"orelse\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(orelse, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4797,6 +4857,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "AsyncFor field \"body\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(body, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4821,6 +4885,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "AsyncFor field \"orelse\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(orelse, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4869,6 +4937,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "While field \"body\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(body, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4893,6 +4965,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "While field \"orelse\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(orelse, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4941,6 +5017,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "If field \"body\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(body, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -4965,6 +5045,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "If field \"orelse\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(orelse, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -5001,6 +5085,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
withitem_ty value;
|
||||
res = obj2ast_withitem(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "With field \"items\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(items, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -5025,6 +5113,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "With field \"body\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(body, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -5061,6 +5153,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
withitem_ty value;
|
||||
res = obj2ast_withitem(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "AsyncWith field \"items\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(items, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -5085,6 +5181,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "AsyncWith field \"body\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(body, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -5155,6 +5255,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Try field \"body\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(body, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -5179,6 +5283,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
excepthandler_ty value;
|
||||
res = obj2ast_excepthandler(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Try field \"handlers\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(handlers, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -5203,6 +5311,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Try field \"orelse\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(orelse, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -5227,6 +5339,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Try field \"finalbody\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(finalbody, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -5296,6 +5412,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
alias_ty value;
|
||||
res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Import field \"names\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(names, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -5343,6 +5463,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
alias_ty value;
|
||||
res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "ImportFrom field \"names\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(names, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -5388,6 +5512,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
identifier value;
|
||||
res = obj2ast_identifier(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Global field \"names\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(names, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -5423,6 +5551,10 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
|
|||
identifier value;
|
||||
res = obj2ast_identifier(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Nonlocal field \"names\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(names, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -5564,6 +5696,10 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
|
|||
expr_ty value;
|
||||
res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "BoolOp field \"values\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(values, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -5760,6 +5896,10 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
|
|||
expr_ty value;
|
||||
res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Dict field \"keys\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(keys, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -5784,6 +5924,10 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
|
|||
expr_ty value;
|
||||
res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Dict field \"values\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(values, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -5819,6 +5963,10 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
|
|||
expr_ty value;
|
||||
res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Set field \"elts\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(elts, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -5866,6 +6014,10 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
|
|||
comprehension_ty value;
|
||||
res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "ListComp field \"generators\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(generators, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -5913,6 +6065,10 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
|
|||
comprehension_ty value;
|
||||
res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "SetComp field \"generators\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(generators, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -5972,6 +6128,10 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
|
|||
comprehension_ty value;
|
||||
res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "DictComp field \"generators\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(generators, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -6019,6 +6179,10 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
|
|||
comprehension_ty value;
|
||||
res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "GeneratorExp field \"generators\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(generators, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -6132,6 +6296,10 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
|
|||
cmpop_ty value;
|
||||
res = obj2ast_cmpop(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Compare field \"ops\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(ops, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -6156,6 +6324,10 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
|
|||
expr_ty value;
|
||||
res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Compare field \"comparators\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(comparators, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -6204,6 +6376,10 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
|
|||
expr_ty value;
|
||||
res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Call field \"args\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(args, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -6228,6 +6404,10 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
|
|||
keyword_ty value;
|
||||
res = obj2ast_keyword(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Call field \"keywords\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(keywords, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -6352,6 +6532,10 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
|
|||
expr_ty value;
|
||||
res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "JoinedStr field \"values\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(values, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -6624,6 +6808,10 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
|
|||
expr_ty value;
|
||||
res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "List field \"elts\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(elts, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -6671,6 +6859,10 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
|
|||
expr_ty value;
|
||||
res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "Tuple field \"elts\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(elts, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -6836,6 +7028,10 @@ obj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena)
|
|||
slice_ty value;
|
||||
res = obj2ast_slice(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "ExtSlice field \"dims\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(dims, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -7196,6 +7392,10 @@ obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena)
|
|||
expr_ty value;
|
||||
res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "comprehension field \"ifs\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(ifs, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -7302,6 +7502,10 @@ obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena)
|
|||
stmt_ty value;
|
||||
res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "ExceptHandler field \"body\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(body, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -7348,6 +7552,10 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
|
|||
arg_ty value;
|
||||
res = obj2ast_arg(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "arguments field \"args\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(args, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -7382,6 +7590,10 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
|
|||
arg_ty value;
|
||||
res = obj2ast_arg(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "arguments field \"kwonlyargs\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(kwonlyargs, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -7406,6 +7618,10 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
|
|||
expr_ty value;
|
||||
res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "arguments field \"kw_defaults\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(kw_defaults, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
@ -7440,6 +7656,10 @@ obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena)
|
|||
expr_ty value;
|
||||
res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena);
|
||||
if (res != 0) goto failed;
|
||||
if (len != PyList_GET_SIZE(tmp)) {
|
||||
PyErr_SetString(PyExc_RuntimeError, "arguments field \"defaults\" changed size during iteration");
|
||||
goto failed;
|
||||
}
|
||||
asdl_seq_SET(defaults, i, value);
|
||||
}
|
||||
Py_CLEAR(tmp);
|
||||
|
|
Loading…
Reference in New Issue