Kaydet (Commit) 28b32ac6 authored tarafından Neal Norwitz's avatar Neal Norwitz

Simplify logic for handling import *

üst b15ec093
...@@ -2440,7 +2440,6 @@ static int ...@@ -2440,7 +2440,6 @@ static int
compiler_from_import(struct compiler *c, stmt_ty s) compiler_from_import(struct compiler *c, stmt_ty s)
{ {
int i, n = asdl_seq_LEN(s->v.ImportFrom.names); int i, n = asdl_seq_LEN(s->v.ImportFrom.names);
int star = 0;
PyObject *names = PyTuple_New(n); PyObject *names = PyTuple_New(n);
if (!names) if (!names)
...@@ -2474,8 +2473,7 @@ compiler_from_import(struct compiler *c, stmt_ty s) ...@@ -2474,8 +2473,7 @@ compiler_from_import(struct compiler *c, stmt_ty s)
if (i == 0 && *PyString_AS_STRING(alias->name) == '*') { if (i == 0 && *PyString_AS_STRING(alias->name) == '*') {
assert(n == 1); assert(n == 1);
ADDOP(c, IMPORT_STAR); ADDOP(c, IMPORT_STAR);
star = 1; return 1;
break;
} }
ADDOP_NAME(c, IMPORT_FROM, alias->name, names); ADDOP_NAME(c, IMPORT_FROM, alias->name, names);
...@@ -2488,9 +2486,8 @@ compiler_from_import(struct compiler *c, stmt_ty s) ...@@ -2488,9 +2486,8 @@ compiler_from_import(struct compiler *c, stmt_ty s)
return 0; return 0;
} }
} }
if (!star) /* remove imported module */
/* remove imported module */ ADDOP(c, POP_TOP);
ADDOP(c, POP_TOP);
return 1; return 1;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment