diff options
-rw-r--r-- | numpy/__init__.py | 4 | ||||
-rw-r--r-- | numpy/core/__init__.py | 1 | ||||
-rw-r--r-- | numpy/tests/test__all__.py | 9 |
3 files changed, 13 insertions, 1 deletions
diff --git a/numpy/__init__.py b/numpy/__init__.py index c34434e75..8f7a42d10 100644 --- a/numpy/__init__.py +++ b/numpy/__init__.py @@ -233,6 +233,10 @@ else: __all__.extend(lib.__all__) __all__.extend(['linalg', 'fft', 'random', 'ctypeslib', 'ma']) + # Remove one of the two occurrences of `issubdtype`, which is exposed as + # both `numpy.core.issubdtype` and `numpy.lib.issubdtype`. + __all__.remove('issubdtype') + # These are exported by np.core, but are replaced by the builtins below # remove them to ensure that we don't end up with `np.long == np.int_`, # which would be a breaking change. diff --git a/numpy/core/__init__.py b/numpy/core/__init__.py index 332f9940e..b89e27f0f 100644 --- a/numpy/core/__init__.py +++ b/numpy/core/__init__.py @@ -106,7 +106,6 @@ from . import _methods __all__ = ['char', 'rec', 'memmap'] __all__ += numeric.__all__ -__all__ += fromnumeric.__all__ __all__ += ['record', 'recarray', 'format_parser'] __all__ += ['chararray'] __all__ += function_base.__all__ diff --git a/numpy/tests/test__all__.py b/numpy/tests/test__all__.py new file mode 100644 index 000000000..e44bda3d5 --- /dev/null +++ b/numpy/tests/test__all__.py @@ -0,0 +1,9 @@ + +import collections +import numpy as np + + +def test_no_duplicates_in_np__all__(): + # Regression test for gh-10198. + dups = {k: v for k, v in collections.Counter(np.__all__).items() if v > 1} + assert len(dups) == 0 |