diff Python/compile.c @ 17262:a626acc30fc2 2.0

Fix memory leak with from import ...
author Moshe Zadka <moshez@math.huji.ac.il>
date Fri, 30 Mar 2001 18:50:23 +0000
parents a002918fc0c2
children 51811d78a9da
line wrap: on
line diff
--- a/Python/compile.c	Fri Mar 30 18:27:11 2001 +0000
+++ b/Python/compile.c	Fri Mar 30 18:50:23 2001 +0000
@@ -2325,11 +2325,11 @@
 com_import_stmt(struct compiling *c, node *n)
 {
 	int i;
-	PyObject *tup;
 	REQ(n, import_stmt);
 	/* 'import' dotted_name (',' dotted_name)* |
 	   'from' dotted_name 'import' ('*' | NAME (',' NAME)*) */
 	if (STR(CHILD(n, 0))[0] == 'f') {
+		PyObject *tup;
 		/* 'from' dotted_name 'import' ... */
 		REQ(CHILD(n, 1), dotted_name);
 		
@@ -2344,6 +2344,7 @@
 			}
 		}
 		com_addoparg(c, LOAD_CONST, com_addconst(c, tup));
+		Py_DECREF(tup);
 		com_push(c, 1);
 		com_addopname(c, IMPORT_NAME, CHILD(n, 1));
 		if (TYPE(CHILD(n, 3)) == STAR)