Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation warnings from surfarray.py after numpy version 1.20.0 #2814

Closed
MyreMylar opened this issue Nov 3, 2021 · 0 comments · Fixed by #2815
Closed

Deprecation warnings from surfarray.py after numpy version 1.20.0 #2814

MyreMylar opened this issue Nov 3, 2021 · 0 comments · Fixed by #2815
Labels
enhancement surfarray pygame.surfarray

Comments

@MyreMylar
Copy link
Contributor

Specifically this section:

# float96 not available on all numpy versions.
numpy_floats = []
for type_name in "float float32 float64 float96".split():
if hasattr(numpy, type_name):
numpy_floats.append(getattr(numpy, type_name))

It appears that numpy.float has been deprecated in Numpy 1.20.0 (along with some other numpy types that were just aliases to python builtin types) so we should now just be using the standard python float type. See:

https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

I'm not 100% that we should just swap out numpy.float for float in this list but from a quick skim that seems to be the recommendation.

This just popped up for me after upgrading a bunch of python libraries and running through my test suite.

Full Deprecation warning looks like this:

surfarray.py:54: DeprecationWarning: `np.float` is a deprecated alias for the builtin `float`. To silence this warning, use `float` by itself. Doing this wi
ll not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
  Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
    numpy_floats.append(getattr(numpy, type_name))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement surfarray pygame.surfarray
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant