Skip to content

Conversation

@tacaswell
Copy link
Member

This is a workaround to https://bugs.python.org/issue37980

I see failures on this locally, but we do not see these failures on the azure pre-release, not sure why.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant

@tacaswell
Copy link
MemberAuthor

force-pushed to fix spelling 🙄

@tacaswelltacaswell changed the title MNT: explicitly cast np.bool_ -> bool to prevent derpcation warningsMNT: explicitly cast np.bool_ -> bool to prevent deprecation warningSep 2, 2019
@tacaswell
Copy link
MemberAuthor

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.

@tacaswell
Copy link
MemberAuthor

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.

@tacaswelltacaswellforce-pushed the mnt_py38_npbool_warnings branch from f87f7b4 to 6df091fCompareSeptember 3, 2019 19:49
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.
@tacaswelltacaswellforce-pushed the mnt_py38_npbool_warnings branch from 6df091f to 3c93e41CompareSeptember 4, 2019 15:57
@tacaswell
Copy link
MemberAuthor

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.

@tacaswell
Copy link
MemberAuthor

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).

@jklymakjklymak merged commit b965c4d into matplotlib:masterSep 4, 2019
@lumberbot-app
Copy link

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
$ git checkout v2.2.x $ git pull 
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 b965c4d4603caac702fa2530ac88d35dd3bb4df9 
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #15168: MNT: explicitly cast np.bool_ -> bool to prevent deprecation warning' 
  1. Push to a named branch :
git push YOURFORK v2.2.x:auto-backport-of-pr-15168-on-v2.2.x 
  1. Create a PR against branch v2.2.x, I would have named this PR:

"Backport PR #15168 on branch v2.2.x"

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.

meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Sep 4, 2019
tacaswell added a commit that referenced this pull request Sep 4, 2019
…168-on-v3.1.x Backport PR #15168 on branch v3.1.x (MNT: explicitly cast np.bool_ -> bool to prevent deprecation warning)
@tacaswelltacaswell deleted the mnt_py38_npbool_warnings branch September 4, 2019 19:46
@tacaswelltacaswell modified the milestones: v2.2.5, v3.1.2Sep 5, 2019
@tacaswell
Copy link
MemberAuthor

this code path is not in 2.2.x, these changes came in via 7f7b048 which is only in 3.1.1+

@QuLogic
Copy link
Member

FTR, this works for Python 3.8.0b4: https://koji.fedoraproject.org/koji/taskinfo?taskID=37504715

Sign up for freeto 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.

4 participants

@tacaswell@QuLogic@dstansby@jklymak