]> granicus.if.org Git - python/commitdiff
fix refleak
authorBenjamin Peterson <benjamin@python.org>
Sun, 21 Nov 2010 15:12:34 +0000 (15:12 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sun, 21 Nov 2010 15:12:34 +0000 (15:12 +0000)
Parser/asdl_c.py
Python/Python-ast.c

index c5fd365f214f43f53c45b259547853c4f5bfea16..d6555d6d7252bd40c9bdba410d93c29a10c71c76 100755 (executable)
@@ -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)
index 4d26ec8de7341d06f21f9fe42fda1775f3e9c0af..2c09f96f0edd520f60b8e7f48d98415a55bc3561 100644 (file)
@@ -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;
 }