diff options
| author | Moshe Zadka <moshez@math.huji.ac.il> | 2001-03-30 18:50:23 (GMT) |
|---|---|---|
| committer | Moshe Zadka <moshez@math.huji.ac.il> | 2001-03-30 18:50:23 (GMT) |
| commit | 4bdc9670bbc11510af54900a8f31a6370cf168ac (patch) | |
| tree | bec77dbac22ebf532de37dc62a34acd403f49ab5 /Python | |
| parent | 641efd396e6e7b8a942d9eecd386931d3818c2ce (diff) | |
| download | cpython-4bdc9670bbc11510af54900a8f31a6370cf168ac.zip cpython-4bdc9670bbc11510af54900a8f31a6370cf168ac.tar.gz cpython-4bdc9670bbc11510af54900a8f31a6370cf168ac.tar.bz2 | |
Fix memory leak with from import ...
Diffstat (limited to 'Python')
| -rw-r--r-- | Python/compile.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c index 77ae001..aca1705 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -2325,11 +2325,11 @@ static void 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_import_stmt(struct compiling *c, node *n) } } 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) |
