Mercurial > cpython-lru_cache-weakref
diff Python/compile.c @ 14230:31925ab46b23 legacy-trunk
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'.
| author | Thomas Wouters <thomas@python.org> |
|---|---|
| date | Sun, 27 Aug 2000 20:16:32 +0000 |
| parents | 11a26e963dc9 |
| children | 1f1a156ed5af |
line wrap: on
line diff
--- a/Python/compile.c Sun Aug 27 20:00:35 2000 +0000 +++ b/Python/compile.c Sun Aug 27 20:16:32 2000 +0000 @@ -2354,12 +2354,15 @@ 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,
