Mercurial > cpython-lru_cache-weakref
diff Python/Python-ast.c @ 84855:65121aa79ab3 3.3
Issue #18552: Check return value of PyArena_AddPyObject() in obj2ast_object().
| author | Christian Heimes <christian@cheimes.de> |
|---|---|
| date | Sat, 27 Jul 2013 00:33:13 +0200 |
| parents | d14f40c87438 |
| children | ad90fc28769a |
line wrap: on
line diff
--- a/Python/Python-ast.c Sat Jul 27 00:03:47 2013 +0200 +++ b/Python/Python-ast.c Sat Jul 27 00:33:13 2013 +0200 @@ -688,9 +688,13 @@ { 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; }
