8000 FIX: do not replace the Axes._children list object by tacaswell · Pull Request #24677 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

FIX: do not replace the Axes._children list object #24677

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
merged 1 commit into from
Dec 9, 2022

Conversation

tacaswell
Copy link
Member

PR Summary

Each Artist keeps a reference to Axes._children.remove as art._remove_method. If we replace the _children instance on the Axes with a different list instance the Artists will not be updated and their remove method will refer to the wrong list. This will cause subsequent failures on the next draw because on remove we reset the art.axes and art.figure to None.

xref https://discourse.matplotlib.org/t/host-subplot-and-artist-remove/23374

PR Checklist

Documentation and Tests

  • Has pytest style unit tests (and pytest passes)
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).

Each Artist keeps a reference to `Axes._children.remove` as
`art._remove_method`.  If we replace the `_children` instance on the Axes with
a different list instance the Artists will not be updated and their remove
method will refer to the wrong list.  This will cause subsequent failures on
the next draw because on remove we reset the `art.axes` and `art.figure` to
None.

xref https://discourse.matplotlib.org/t/host-subplot-and-artist-remove/23374
@tacaswell tacaswell added this to the v3.6.3 milestone Dec 9, 2022
@ksunden ksunden merged commit 4d52a3e into matplotlib:main Dec 9, 2022
@lumberbot-app
Copy link
lumberbot-app bot commented Dec 9, 2022

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.6.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -x -m1 4d52a3e6feffb091e737da1c06943ebd80d67c25
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #24677: FIX: do not replace the Axes._children list object'
  1. Push to a named branch:
git push YOURFORK v3.6.x:auto-backport-of-pr-24677-on-v3.6.x
  1. Create a PR against branch v3.6.x, I would have named this PR:

"Backport PR #24677 on branch v3.6.x (FIX: do not replace the Axes._children list object)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

rcomer pushed a commit to rcomer/matplotlib that referenced this pull request Dec 9, 2022
…list object

Manual backport due to conflicts, which were just additional tests in
main from matplotlib#23861, so simply removed these.
tacaswell added a commit that referenced this pull request Dec 9, 2022
Backport PR #24677 on branch v3.6.x (FIX: do not replace the Axes._children list object)
@ksunden ksunden mentioned this pull request Feb 20, 2023
6 tasks
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.

4 participants
0