]> granicus.if.org Git - python/commitdiff
Fix SF bug [ #445474 ] warn about import * inside functions
authorJeremy Hylton <jeremy@alum.mit.edu>
Mon, 6 Aug 2001 19:45:40 +0000 (19:45 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Mon, 6 Aug 2001 19:45:40 +0000 (19:45 +0000)
Reported by the Man himself.

Python/compile.c

index ad616f24c61de91771b1719f6d24f4dba6c79705..dc31d2fce40e2b1a24febd59f7bef36db86aa7a3 100644 (file)
@@ -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 {