8000 Don't disable obsolete Py2 names with ``from future.builtins import *`` · thecodingchicken/python-future@071f8e7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 071f8e7

Browse files
committed
Don't disable obsolete Py2 names with from future.builtins import *
- These can still be disabled if needed using:: from future.builtins.disabled import * But they can be handy -- e.g. for user code like this: if PY2: if isinstance(x, long): ...
1 parent fc9c24a commit 071f8e7

File tree

2 files changed

+15
-20
lines changed

2 files changed

+15
-20
lines changed

future/builtins/__init__.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,12 @@
1919
if not utils.PY3:
2020
# We only import names that shadow the builtins on Py2. No other namespace
2121
# pollution on Py2.
22-
from future.builtins.disabled import (apply, cmp, coerce,
23-
execfile, file, long, raw_input, reduce, reload, unicode,
24-
xrange, StandardError)
2522

2623
# Only shadow builtins on Py2; no new names
2724
__all__ = ['filter', 'map', 'zip',
28-
'ascii', 'oct', 'hex', 'chr', 'int', 'input', 'open',
29-
'str', 'bytes', 'range', 'round', 'super',
30-
'apply', 'cmp', 'coerce', 'execfile', 'file', 'long',
31-
'raw_input', 'reduce', 'reload', 'unicode', 'xrange',
32-
'StandardError']
25+
'ascii', 'chr', 'hex', 'input', 'oct', 'open',
26+
'bytes', 'int', 'range', 'round', 'str', 'super',
27+
]
3328

3429
else:
3530
# No namespace pollution on Py3

future/tests/test_explicit_imports.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,18 @@ def test_py2k_disabled_builtins(self):
3030
On Py2 these should import.
3131
"""
3232
if not utils.PY3:
33-
from future.builtins import (apply,
34-
cmp,
35-
coerce,
36-
execfile,
37-
file,
38-
long,
39-
raw_input,
40-
reduce,
41-
reload,
42-
unicode,
43-
xrange,
44-
StandardError)
33+
from future.builtins.disabled import (apply,
34+
cmp,
35+
coerce,
36+
execfile,
37+
file,
38+
long,
39+
raw_input,
40+
reduce,
41+
reload,
42+
unicode,
43+
xrange,
44+
StandardError)
4545

4646

4747
if __name__ == '__main__':

0 commit comments

Comments
 (0)
0