summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-11-21 15:12:34 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-11-21 15:12:34 (GMT)
commit0a4dae5309ab30d3a217d3eb0329e3b3feec736c (patch)
tree66d08d0834fa6a38f6872c86c5c48d36c6797b0d
parente4dad4f8e239be6d9d1fd3e5398584a7d2a14edb (diff)
downloadcpython-0a4dae5309ab30d3a217d3eb0329e3b3feec736c.zip
cpython-0a4dae5309ab30d3a217d3eb0329e3b3feec736c.tar.gz
cpython-0a4dae5309ab30d3a217d3eb0329e3b3feec736c.tar.bz2
fix refleak
-rwxr-xr-xParser/asdl_c.py1
-rw-r--r--Python/Python-ast.c5
2 files changed, 6 insertions, 0 deletions
diff --git a/Parser/asdl_c.py b/Parser/asdl_c.py
index c5fd365..d6555d6 100755
--- a/Parser/asdl_c.py
+++ b/Parser/asdl_c.py
@@ -376,6 +376,7 @@ class Obj2ModVisitor(PickleVisitor):
self.emit(format % error, 1, reflow=False)
if add_label:
self.emit("failed:", 1)
+ self.emit("Py_XDECREF(tmp);", 1)
self.emit("return 1;", 1)
self.emit("}", 0)
self.emit("", 0)
diff --git a/Python/Python-ast.c b/Python/Python-ast.c
index 4d26ec8..2c09f96 100644
--- a/Python/Python-ast.c
+++ b/Python/Python-ast.c
@@ -3516,6 +3516,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena)
PyErr_Format(PyExc_TypeError, "expected some sort of mod, but got %R", obj);
failed:
+ Py_XDECREF(tmp);
return 1;
}
@@ -4711,6 +4712,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena)
PyErr_Format(PyExc_TypeError, "expected some sort of stmt, but got %R", obj);
failed:
+ Py_XDECREF(tmp);
return 1;
}
@@ -5826,6 +5828,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena)
PyErr_Format(PyExc_TypeError, "expected some sort of expr, but got %R", obj);
failed:
+ Py_XDECREF(tmp);
return 1;
}
@@ -6006,6 +6009,7 @@ obj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena)
PyErr_Format(PyExc_TypeError, "expected some sort of slice, but got %R", obj);
failed:
+ Py_XDECREF(tmp);
return 1;
}
@@ -6438,6 +6442,7 @@ obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena)
PyErr_Format(PyExc_TypeError, "expected some sort of excepthandler, but got %R", obj);
failed:
+ Py_XDECREF(tmp);
return 1;
}