Commit 08995a33 authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #24098: Fixed possible crash when AST is changed in process of

compiling it.
parent bc4bdbd6
......@@ -10,6 +10,9 @@ What's New in Python 2.7.13?
Core and Builtins
-----------------
- Issue #24098: Fixed possible crash when AST is changed in process of
compiling it.
- Issue #28350: String constants with null character no longer interned.
- Issue #27942: String constants now interned recursively in tuples and frozensets.
......
......@@ -513,6 +513,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:
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment