From: Jeremy Hylton Date: Mon, 6 Aug 2001 19:45:40 +0000 (+0000) Subject: Fix SF bug [ #445474 ] warn about import * inside functions X-Git-Tag: v2.2a3~792 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8a6f29530388277bdb3e5432eaf3c6c6571ab304;p=python Fix SF bug [ #445474 ] warn about import * inside functions Reported by the Man himself. --- diff --git a/Python/compile.c b/Python/compile.c index ad616f24c6..dc31d2fce4 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 {