@@ -583,35 +583,6 @@ drop_class_free(PySTEntryObject *ste, PyObject *free)
583583 return 1 ;
584584}
585585
586- /* Check for illegal statements in unoptimized namespaces */
587- static int
588- check_unoptimized (const PySTEntryObject * ste ) {
589- const char * trailer ;
590-
591- if (ste -> ste_type != FunctionBlock || !ste -> ste_unoptimized
592- || !(ste -> ste_free || ste -> ste_child_free ))
593- return 1 ;
594-
595- trailer = (ste -> ste_child_free ?
596- "contains a nested function with free variables" :
597- "is a nested function" );
598-
599- switch (ste -> ste_unoptimized ) {
600- case OPT_TOPLEVEL : /* import * at top-level is fine */
601- return 1 ;
602- case OPT_IMPORT_STAR :
603- PyErr_Format (PyExc_SyntaxError ,
604- "import * is not allowed in function '%U' because it %s" ,
605- ste -> ste_name , trailer );
606- break ;
607- }
608-
609- PyErr_SyntaxLocationObject (ste -> ste_table -> st_filename ,
610- ste -> ste_opt_lineno ,
611- ste -> ste_opt_col_offset );
612- return 0 ;
613- }
614-
615586/* Enter the final scope information into the ste_symbols dict.
616587 *
617588 * All arguments are dicts. Modifies symbols, others are read-only.
@@ -854,8 +825,6 @@ analyze_block(PySTEntryObject *ste, PyObject *bound, PyObject *free,
854825 if (!update_symbols (ste -> ste_symbols , scopes , bound , newfree ,
855826 ste -> ste_type == ClassBlock ))
856827 goto error ;
857- if (!check_unoptimized (ste ))
858- goto error ;
859828
860829 temp = PyNumber_InPlaceOr (free , newfree );
861830 if (!temp )
0 commit comments