summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2019-11-11 22:25:22 +0000
committerEric Wieser <wieser.eric@gmail.com>2019-11-12 09:25:59 +0000
commit9ce99dd8b682754ca0efe0cb2fc1dad9f03fb234 (patch)
tree81e5bac6d17eb762c6bb02d3f933c387cefcf6ee /numpy
parent035ef5ac3ca52b9f14ea3effe739c6aaca9411bc (diff)
downloadnumpy-9ce99dd8b682754ca0efe0cb2fc1dad9f03fb234.tar.gz
BUG: Remove builtins from __all__
This was introduced in 3ca0eb1136102ff01bcc171f53c106326fa4445b, due to an incorrect implementation of `__dir__` (fixed in the previous commit). It was never released, so this is not a breaking change. In that commit, `from numpy import *` would reset all the builtins to their defaults, and set `unicode = str`, `long = int`.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/__init__.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/numpy/__init__.py b/numpy/__init__.py
index 722dcc45b..349914b2f 100644
--- a/numpy/__init__.py
+++ b/numpy/__init__.py
@@ -158,6 +158,7 @@ else:
# Make these accessible from numpy name-space
# but not imported in from numpy import *
+ # TODO[gh-6103]: Deprecate these
if sys.version_info[0] >= 3:
from builtins import bool, int, float, complex, object, str
unicode = str
@@ -168,14 +169,17 @@ else:
# now that numpy modules are imported, can initialize limits
core.getlimits._register_known_types()
- __all__.extend(['bool', 'int', 'float', 'complex', 'object', 'unicode',
- 'str'])
__all__.extend(['__version__', 'show_config'])
__all__.extend(core.__all__)
__all__.extend(_mat.__all__)
__all__.extend(lib.__all__)
__all__.extend(['linalg', 'fft', 'random', 'ctypeslib', 'ma'])
+ # These are added by `from .core import *` and `core.__all__`, but we
+ # overwrite them above with builtins we do _not_ want to export.
+ __all__.remove('long')
+ __all__.remove('unicode')
+
# Remove things that are in the numpy.lib but not in the numpy namespace
# Note that there is a test (numpy/tests/test_public_api.py:test_numpy_namespace)
# that prevents adding more things to the main namespace by accident.