This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Remove unused code in symtable.c and fix docs for import * checking
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.5
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: brett.cannon, ncw, python-dev
Priority: normal Keywords: patch

Created on 2015-04-24 12:36 by ncw, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python3.5-symtable.patch ncw, 2015-04-24 12:36 Remove unused code in symtable.c and fix docs for import * checking review
Messages (2)
msg241937 - (view) Author: Nick Craig-Wood (ncw) * Date: 2015-04-24 12:36
Here is a patch to remove some unused code in `symtable.c`

In Python3 `from x import *` was banned from use in functions completely.

This is detected by `symtable_visit_alias` 

        if (st->st_cur->ste_type != ModuleBlock) {
            int lineno = st->st_cur->ste_lineno;
            int col_offset = st->st_cur->ste_col_offset;
            PyErr_SetString(PyExc_SyntaxError, IMPORT_STAR_WARNING);

However in `check_unoptimized` it checks for `import *` being used in a nested function etc.  This is the python2 behaviour which wasn't removed at the time the new python3 behaviour was added.

According to my analysis and tests it is now impossible for `check_unoptimized` to raise an error, since only valid uses of `import *` are left at the point it is called.

I propose to remove that function entirely, its call, and fix some stray documentation in this patch.
msg241951 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-04-24 16:03
New changeset 135d5a3e415b by Benjamin Peterson in branch '3.4':
remove dead *-import checking code (closes #24049)
https://hg.python.org/cpython/rev/135d5a3e415b

New changeset 5c0247a6f98a by Benjamin Peterson in branch 'default':
merge 3.4 (#24049)
https://hg.python.org/cpython/rev/5c0247a6f98a
History
Date User Action Args
2022-04-11 14:58:16adminsetgithub: 68237
2015-04-24 16:03:00python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg241951

resolution: fixed
stage: resolved
2015-04-24 14:38:00brett.cannonsetnosy: + brett.cannon
2015-04-24 12:36:02ncwcreate