Author: neal.norwitz
Date: Sun Aug  5 04:19:04 2007
New Revision: 56748

Modified:
   python/branches/p3yk/Lib/test/test_scope.py
   python/branches/p3yk/Python/symtable.c
Log:
Make from X import * outside module scope an error.

Modified: python/branches/p3yk/Lib/test/test_scope.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_scope.py (original)
+++ python/branches/p3yk/Lib/test/test_scope.py Sun Aug  5 04:19:04 2007
@@ -223,25 +223,6 @@
         return getrefcount # global or local?
 """)
 
-        # and verify a few cases that should work
-
-        exec("""
-def noproblem1():
-    from sys import *
-    f = lambda x:x
-
-def noproblem2():
-    from sys import *
-    def f(x):
-        return x + 1
-
-def noproblem3():
-    from sys import *
-    def f(x):
-        global y
-        y = x
-""")
-
     def testLambdas(self):
 
         f1 = lambda x: lambda y: x + y

Modified: python/branches/p3yk/Python/symtable.c
==============================================================================
--- python/branches/p3yk/Python/symtable.c      (original)
+++ python/branches/p3yk/Python/symtable.c      Sun Aug  5 04:19:04 2007
@@ -1478,10 +1478,10 @@
        else {
             if (st->st_cur->ste_type != ModuleBlock) {
                 int lineno = st->st_cur->ste_lineno;
-                if (!symtable_warn(st, IMPORT_STAR_WARNING, lineno)) {
-                    Py_DECREF(store_name);
-                    return 0;
-               }
+                PyErr_SetString(PyExc_SyntaxError, IMPORT_STAR_WARNING);
+                PyErr_SyntaxLocation(st->st_filename, lineno);
+                Py_DECREF(store_name);
+                return 0;
             }
            st->st_cur->ste_unoptimized |= OPT_IMPORT_STAR;
            Py_DECREF(store_name);
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to