Skip to content
This repository has been archived by the owner on Jul 27, 2024. It is now read-only.

remove deprecated numpy type aliases #258

Merged
merged 1 commit into from
May 23, 2023

Conversation

jonathan-lemos
Copy link
Contributor

NumPy 1.20 deprecated the type aliases np.bool and np.str. As of NumPy 1.24.3, these aliases have been removed entirely, as seen below:

Python 3.9.15 (main, Nov 10 2022, 15:40:56) 
[GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy
>>> numpy.bool
<stdin>:1: FutureWarning: In the future `np.bool` will be defined as the corresponding NumPy scalar.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/archbtw/.pyenv/versions/3.9.15/lib/python3.9/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

This change replaces the removed NumPy type aliases with their modern equivalents.

@jameswex jameswex merged commit e48443d into PAIR-code:master May 23, 2023
@jameswex
Copy link
Contributor

released pip version 1.1.1 with this change

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants