summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorThomas Wouters <thomas@python.org>2000-08-27 20:16:32 (GMT)
committerThomas Wouters <thomas@python.org>2000-08-27 20:16:32 (GMT)
commite753ef8d1bd8df8df7b74ca99de3341b204f2277 (patch)
treee2382517916cd41096849638382a231782079a76 /Python/compile.c
parent8ebe84dff587ad921000062fc1bbfd6146b5d36a (diff)
downloadcpython-e753ef8d1bd8df8df7b74ca99de3341b204f2277.zip
cpython-e753ef8d1bd8df8df7b74ca99de3341b204f2277.tar.gz
cpython-e753ef8d1bd8df8df7b74ca99de3341b204f2277.tar.bz2
Re-allow 'import mod.submod as s', and change its meaning to what it should
mean; the same as 'from mod import submod as s'.
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Python/compile.c b/Python/compile.c
index e8462c6..dc6e2fb 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -2354,12 +2354,15 @@ com_import_stmt(struct compiling *c, node *n)
com_addopname(c, IMPORT_NAME, CHILD(subn, 0));
com_push(c, 1);
if (NCH(subn) > 1) {
- if (strcmp(STR(CHILD(subn, 1)), "as") != 0 ||
- NCH(CHILD(subn, 0)) > 1) {
+ int j;
+ if (strcmp(STR(CHILD(subn, 1)), "as") != 0) {
com_error(c, PyExc_SyntaxError,
"invalid syntax");
return;
}
+ for (j=2 ; j < NCH(CHILD(subn, 0)); j += 2)
+ com_addopname(c, LOAD_ATTR,
+ CHILD(CHILD(subn, 0), j));
com_addopname(c, STORE_NAME, CHILD(subn, 2));
} else
com_addopname(c, STORE_NAME,