summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2013-07-26 22:33:13 (GMT)
committerChristian Heimes <christian@cheimes.de>2013-07-26 22:33:13 (GMT)
commit70c94e7896bc46c81e7b9648bde4745ce874f552 (patch)
treeed620e878815892dbed1011f1e5047f2713e0420 /Python
parent1acc129d48121cc7ce5860e6825f14bdb8ea6d09 (diff)
downloadcpython-70c94e7896bc46c81e7b9648bde4745ce874f552.zip
cpython-70c94e7896bc46c81e7b9648bde4745ce874f552.tar.gz
cpython-70c94e7896bc46c81e7b9648bde4745ce874f552.tar.bz2
Issue #18552: Check return value of PyArena_AddPyObject() in obj2ast_object().
Diffstat (limited to 'Python')
-rw-r--r--Python/Python-ast.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index d78657c..7bf2c50 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -688,9 +688,13 @@ static int obj2ast_object(PyObject* obj, PyObject** out, PyArena* arena)
{
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;
}