diff Python/compile.c @ 19018:821e35706c07 legacy-trunk

Fix SF bug [ #445474 ] warn about import * inside functions Reported by the Man himself.
author Jeremy Hylton <jeremy@alum.mit.edu>
date Mon, 06 Aug 2001 19:45:40 +0000
parents 4030c9019067
children 30ae3aff03bd
line wrap: on
line diff
--- a/Python/compile.c	Mon Aug 06 19:33:52 2001 +0000
+++ b/Python/compile.c	Mon Aug 06 19:45:40 2001 +0000
@@ -5294,6 +5294,11 @@
 			}
 		}
 		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 {