summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2001-08-06 19:45:40 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2001-08-06 19:45:40 (GMT)
commit8a6f29530388277bdb3e5432eaf3c6c6571ab304 (patch)
treeacec0b4d1d2c5174d5087df30ed8c1f9a4bebf22 /Python/compile.c
parent5dd064aac3f76b15e83e7a4699f28c8be001729b (diff)
downloadcpython-8a6f29530388277bdb3e5432eaf3c6c6571ab304.zip
cpython-8a6f29530388277bdb3e5432eaf3c6c6571ab304.tar.gz
cpython-8a6f29530388277bdb3e5432eaf3c6c6571ab304.tar.bz2
Fix SF bug [ #445474 ] warn about import * inside functions
Reported by the Man himself.
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c
index ad616f2..dc31d2f 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -5294,6 +5294,11 @@ symtable_import(struct symtable *st, node *n)
}
}
if (TYPE(CHILD(n, 3)) == STAR) {
+ if (st->st_cur->ste_type != TYPE_MODULE) {
+ symtable_warn(st,
+ "import * not allowed inside function");
+ return;
+ }
st->st_cur->ste_optimized |= OPT_IMPORT_STAR;
st->st_cur->ste_opt_lineno = n->n_lineno;
} else {