Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
718c0655
Commit
718c0655
authored
Apr 24, 2015
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove dead *-import checking code (closes #24049)
parent
ca6c30b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
35 deletions
+0
-35
Doc/reference/executionmodel.rst
Doc/reference/executionmodel.rst
+0
-4
Python/symtable.c
Python/symtable.c
+0
-31
No files found.
Doc/reference/executionmodel.rst
View file @
718c0655
...
...
@@ -161,10 +161,6 @@ conjunction with nested scopes that contain free variables.
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
...
...
Python/symtable.c
View file @
718c0655
...
...
@@ -583,35 +583,6 @@ drop_class_free(PySTEntryObject *ste, PyObject *free)
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 @@ analyze_block(PySTEntryObject *ste, PyObject *bound, PyObject *free,
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment