mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Fix SF bug [ #445474 ] warn about import * inside functions
Reported by the Man himself.
This commit is contained in:
parent
5dd064aac3
commit
8a6f295303
1 changed files with 5 additions and 0 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue