Skip to content

MNT: make sure we do not mutate input in Text.update #18839

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

Merged

Conversation

tacaswell
Copy link
Member

PR Summary

We take in a dictionary (called kwargs rather than collecting kwargs)
which we mutate in the method. We pop bbox and fontproperties keys
out of the user supplied dictionary (to make sure the precedence and
default behaviors are correct) which is propagated back out to user
code.

This makes an internal copy of the dictionary before we mutate it.

closes #18838

@shevawen Can you please confirm that this fixes your problem?

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).

@tacaswell tacaswell added this to the v3.3.3 milestone Oct 29, 2020
We take in a dictionary (called kwargs rather than collecting kwargs)
which we mutate in the method.  We pop bbox and fontproperties keys
out of the user supplied dictionary (to make sure the precedence and
default behaviors are correct) which is propagated back out to user
code.

This makes an internal copy of the dictionary before we mutate it.

closes matplotlib#18838
@tacaswell tacaswell force-pushed the fix_Text_update_mutating_input branch from 6df1210 to 3f65a59 Compare October 29, 2020 21:02
@tacaswell
Copy link
Member Author

fixed and pushed.

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anybody can merge after CI pass.

@shevawen
Copy link

@tacaswell That works. Thanks.

@timhoffm timhoffm merged commit 33164e1 into matplotlib:master Oct 30, 2020
@lumberbot-app
Copy link

lumberbot-app bot commented Oct 30, 2020

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 v3.3.x
$ git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
$ git cherry-pick -m1 33164e15612c38e0c6338e2e8fb5aab9aa4912ac
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
$ git commit -am 'Backport PR #18839: MNT: make sure we do not mutate input in Text.update'
  1. Push to a named branch :
git push YOURFORK v3.3.x:auto-backport-of-pr-18839-on-v3.3.x
  1. Create a PR against branch v3.3.x, I would have named this PR:

"Backport PR #18839 on branch v3.3.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.

QuLogic pushed a commit to QuLogic/matplotlib that referenced this pull request Oct 30, 2020
QuLogic added a commit that referenced this pull request Oct 31, 2020
@tacaswell tacaswell deleted the fix_Text_update_mutating_input branch May 6, 2021 23:04
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.

5 participants