Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 35993:a29c89b4e8c6 legacy-trunk
Simplify logic for handling import *
| author | Neal Norwitz <nnorwitz@gmail.com> |
|---|---|
| date | Tue, 06 Dec 2005 07:41:30 +0000 |
| parents | 79374eb6db51 |
| children | ea083efdc96c |
line wrap: on
line diff
--- a/Python/compile.c Tue Dec 06 07:26:02 2005 +0000 +++ b/Python/compile.c Tue Dec 06 07:41:30 2005 +0000 @@ -2440,7 +2440,6 @@ compiler_from_import(struct compiler *c, stmt_ty s) { int i, n = asdl_seq_LEN(s->v.ImportFrom.names); - int star = 0; PyObject *names = PyTuple_New(n); if (!names) @@ -2474,8 +2473,7 @@ if (i == 0 && *PyString_AS_STRING(alias->name) == '*') { assert(n == 1); ADDOP(c, IMPORT_STAR); - star = 1; - break; + return 1; } ADDOP_NAME(c, IMPORT_FROM, alias->name, names); @@ -2488,9 +2486,8 @@ return 0; } } - if (!star) - /* remove imported module */ - ADDOP(c, POP_TOP); + /* remove imported module */ + ADDOP(c, POP_TOP); return 1; }
