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

Fix NumPy warning in test_functions #2746

Merged
merged 1 commit into from Jun 16, 2023
Merged

Conversation

swt2c
Copy link
Contributor

@swt2c swt2c commented Jun 15, 2023

Fixes the below warning about integer conversion by using astype() - overflow seems OK/desired in this case.

tests/test_functions.py:290
  /home/runner/work/pyqtgraph/pyqtgraph/tests/test_functions.py:290: DeprecationWarning: NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays.  The conversion of -1 to uint32 will fail in the future.
  For the old behavior, usually:
      np.array(value).astype(dtype)`
  will give the desired result (the cast overflows).
    np.arange(6, dtype=dtype), np.arange(0, -6, step=-1, dtype=dtype), 'all',

Fixes the below warning about integer conversion by using astype() -
overflow seems OK/desired in this case.

tests/test_functions.py:290
  /home/runner/work/pyqtgraph/pyqtgraph/tests/test_functions.py:290: DeprecationWarning: NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays.  The conversion of -1 to uint32 will fail in the future.
  For the old behavior, usually:
      np.array(value).astype(dtype)`
  will give the desired result (the cast overflows).
    np.arange(6, dtype=dtype), np.arange(0, -6, step=-1, dtype=dtype), 'all',
@swt2c
Copy link
Contributor Author

swt2c commented Jun 15, 2023

The test failures seem to be unrelated. In fact, they seem possibly related to Python 3.11.4?

@j9ac9k
Copy link
Member

j9ac9k commented Jun 15, 2023

Thanks for fixing this; I'll investigate the failures today!

@swt2c
Copy link
Contributor Author

swt2c commented Jun 15, 2023

I think the failures might actually be due to this CPython bug: python/cpython#105497

@j9ac9k
Copy link
Member

j9ac9k commented Jun 15, 2023

ahh, yeah saw some chatter about this on the pyqt mail list... looks like it will be fixed in 3.11.5. I'm good with merging as is, should probably put a note on the README about an incompatibility with PyQt/Python 3.11.4, but that's out of scope for this PR.

@swt2c do you have a preferred method I can reach out to you privately? If you have some time, would you mind sending me a message on your preferred platform? My contact info is on my github profile page

@swt2c
Copy link
Contributor Author

swt2c commented Jun 15, 2023

@j9ac9k sent you an email.

@j9ac9k
Copy link
Member

j9ac9k commented Jun 16, 2023

Thanks for the PR @swt2c this LGTM, merging!

@j9ac9k j9ac9k merged commit d1aa350 into pyqtgraph:master Jun 16, 2023
26 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants