[Python-checkins] cpython (merge 3.4 -> default): merge 3.4 (#24049)

benjamin.peterson python-checkins at python.org
Fri Apr 24 18:03:00 CEST 2015


https://hg.python.org/cpython/rev/5c0247a6f98a
changeset:   95792:5c0247a6f98a
parent:      95790:151cab576cab
parent:      95791:135d5a3e415b
user:        Benjamin Peterson <benjamin at python.org>
date:        Fri Apr 24 12:02:53 2015 -0400
summary:
  merge 3.4 (#24049)

files:
  Doc/reference/executionmodel.rst |   4 --
  Python/symtable.c                |  31 --------------------
  2 files changed, 0 insertions(+), 35 deletions(-)


diff --git a/Doc/reference/executionmodel.rst b/Doc/reference/executionmodel.rst
--- a/Doc/reference/executionmodel.rst
+++ b/Doc/reference/executionmodel.rst
@@ -161,10 +161,6 @@
 If a variable is referenced in an enclosing scope, it is illegal to delete the
 name.  An error will be reported at compile time.
 
-If the wild card form of import --- ``import *`` --- is used in a function and
-the function contains or is a nested block with free variables, the compiler
-will raise a :exc:`SyntaxError`.
-
 .. XXX from * also invalid with relative imports (at least currently)
 
 The :func:`eval` and :func:`exec` functions do not have access to the full
diff --git a/Python/symtable.c b/Python/symtable.c
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -583,35 +583,6 @@
     return 1;
 }
 
-/* Check for illegal statements in unoptimized namespaces */
-static int
-check_unoptimized(const PySTEntryObject* ste) {
-    const char* trailer;
-
-    if (ste->ste_type != FunctionBlock || !ste->ste_unoptimized
-        || !(ste->ste_free || ste->ste_child_free))
-        return 1;
-
-    trailer = (ste->ste_child_free ?
-                   "contains a nested function with free variables" :
-                   "is a nested function");
-
-    switch (ste->ste_unoptimized) {
-    case OPT_TOPLEVEL: /* import * at top-level is fine */
-        return 1;
-    case OPT_IMPORT_STAR:
-        PyErr_Format(PyExc_SyntaxError,
-                     "import * is not allowed in function '%U' because it %s",
-                     ste->ste_name, trailer);
-        break;
-    }
-
-    PyErr_SyntaxLocationObject(ste->ste_table->st_filename,
-                               ste->ste_opt_lineno,
-                               ste->ste_opt_col_offset);
-    return 0;
-}
-
 /* Enter the final scope information into the ste_symbols dict.
  *
  * All arguments are dicts.  Modifies symbols, others are read-only.
@@ -854,8 +825,6 @@
     if (!update_symbols(ste->ste_symbols, scopes, bound, newfree,
                         ste->ste_type == ClassBlock))
         goto error;
-    if (!check_unoptimized(ste))
-        goto error;
 
     temp = PyNumber_InPlaceOr(free, newfree);
     if (!temp)

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list