diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-06-13 13:06:21 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-06-13 13:06:21 (GMT) |
commit | d1f5a59edb56b64336f07fc88cff6cbebed12dd6 (patch) | |
tree | 4486a70b3c41a35c4adb467c6d9a526bbe887c59 /Python/ast.c | |
parent | 565e1b6bb724af71f439ec914b34f74e5163fe3d (diff) | |
download | cpython-d1f5a59edb56b64336f07fc88cff6cbebed12dd6.zip cpython-d1f5a59edb56b64336f07fc88cff6cbebed12dd6.tar.gz cpython-d1f5a59edb56b64336f07fc88cff6cbebed12dd6.tar.bz2 |
allow importing from a module named None if it has an 'as' clause
Diffstat (limited to 'Python/ast.c')
-rw-r--r-- | Python/ast.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Python/ast.c b/Python/ast.c index 9639350..d259259 100644 --- a/Python/ast.c +++ b/Python/ast.c @@ -2316,8 +2316,10 @@ alias_for_import_name(struct compiling *c, const node *n, int store) if (!str) return NULL; } - if (!forbidden_check(c, name_node, STR(name_node))) - return NULL; + else { + if (!forbidden_check(c, name_node, STR(name_node))) + return NULL; + } name = NEW_IDENTIFIER(name_node); if (!name) return NULL; @@ -2330,11 +2332,11 @@ alias_for_import_name(struct compiling *c, const node *n, int store) } else { node *asname_node = CHILD(n, 2); - alias_ty a = alias_for_import_name(c, CHILD(n, 0), store); + alias_ty a = alias_for_import_name(c, CHILD(n, 0), 0); if (!a) return NULL; assert(!a->asname); - if (store && !forbidden_check(c, asname_node, STR(asname_node))) + if (!forbidden_check(c, asname_node, STR(asname_node))) return NULL; a->asname = NEW_IDENTIFIER(asname_node); if (!a->asname) |