diff -r d14f40c87438 Parser/asdl_c.py --- a/Parser/asdl_c.py Sat Jul 27 00:03:47 2013 +0200 +++ b/Parser/asdl_c.py Sat Jul 27 00:25:42 2013 +0200 @@ -834,9 +834,13 @@ static int obj2ast_object(PyObject* obj, { if (obj == Py_None) obj = NULL; - if (obj) - PyArena_AddPyObject(arena, obj); - Py_XINCREF(obj); + if (obj) { + if (PyArena_AddPyObject(arena, obj) < 0) { + *out = NULL; + return -1; + } + Py_INCREF(obj); + } *out = obj; return 0; } diff -r d14f40c87438 Python/Python-ast.c --- a/Python/Python-ast.c Sat Jul 27 00:03:47 2013 +0200 +++ b/Python/Python-ast.c Sat Jul 27 00:25:42 2013 +0200 @@ -688,9 +688,13 @@ static int obj2ast_object(PyObject* obj, { if (obj == Py_None) obj = NULL; - if (obj) - PyArena_AddPyObject(arena, obj); - Py_XINCREF(obj); + if (obj) { + if (PyArena_AddPyObject(arena, obj) < 0) { + *out = NULL; + return -1; + } + Py_INCREF(obj); + } *out = obj; return 0; }