summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2005-12-06 07:41:30 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2005-12-06 07:41:30 (GMT)
commit28b32ac6bc23b8bc2b7bb37bdd199cf550ab7737 (patch)
tree1c56d8236a07569b10132c7c0cbd841e96c93609
parentb15ec09343262001f2b6398db97481684a201666 (diff)
downloadcpython-28b32ac6bc23b8bc2b7bb37bdd199cf550ab7737.zip
cpython-28b32ac6bc23b8bc2b7bb37bdd199cf550ab7737.tar.gz
cpython-28b32ac6bc23b8bc2b7bb37bdd199cf550ab7737.tar.bz2
Simplify logic for handling import *
-rw-r--r--Python/compile.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 418194e..4ad17b3 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -2440,7 +2440,6 @@ static int
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 @@ compiler_from_import(struct compiler *c, stmt_ty s)
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 @@ compiler_from_import(struct compiler *c, stmt_ty s)
return 0;
}
}
- if (!star)
- /* remove imported module */
- ADDOP(c, POP_TOP);
+ /* remove imported module */
+ ADDOP(c, POP_TOP);
return 1;
}