MNT: explicitly cast np.bool_ -> bool to prevent deprecation warning#15168
MNT: explicitly cast np.bool_ -> bool to prevent deprecation warning#15168jklymak merged 1 commit intomatplotlib:masterfrom
Conversation
181dcf1 to
6df091f
Compare
|
force-pushed to fix spelling 🙄 |
|
ok, I figured out why the python preview is not failing on azure, we are installing py3.8b4, but in the tests are falling back to py3.6.8. |
|
This seems to be hitting https://bugs.python.org/issue37074 which looks like it has been fixed, but not an a tagged pre-release yet. |
f87f7b4 to
6df091f
Compare
This is a workaround to https://bugs.python.org/issue37980 - np.bool raises a warning if you try to use it as an index (by warning in its `__index__` method - in py38 python/cpython#11952 python changes the code path used to convert `np.bool_` -> int for as it is used in `sorted` so it now goes through the `__index__` code path - this causes a bunch of spurious warnings to come out of Matplotlib.
6df091f to
3c93e41
Compare
|
I just force-pushed a commit with in-line comments of why we are doing extra work, will open a PR later today with the "fix" to the azure pre-release python. |
|
Although there is a chance that CPython will fix this before py3.8 is released, there is also a chance that they will decide that this is a NumPy problem so I think we should defensively merge this so we do not have to hold any release on a decision being made upstream (either in NumPy or Python). |
|
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulation you did some good work ! Hopefully your backport PR will be tested by the continuous integration and merged soon! If these instruction are inaccurate, feel free to suggest an improvement. |
…o prevent deprecation warning
…168-on-v3.1.x Backport PR #15168 on branch v3.1.x (MNT: explicitly cast np.bool_ -> bool to prevent deprecation warning)
|
this code path is not in 2.2.x, these changes came in via 7f7b048 which is only in 3.1.1+ |
|
FTR, this works for Python 3.8.0b4: https://koji.fedoraproject.org/koji/taskinfo?taskID=37504715 |
This is a workaround to https://bugs.python.org/issue37980
warning in its
__index__methodthe code path used to convert
np.bool_-> int for as it is used insortedso it now goes through the__index__code pathI see failures on this locally, but we do not see these failures on the azure pre-release, not sure why.
PR Summary
PR Checklist