-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
"Fix" tight_layout for template backend. #17731
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to add a test to make sure this won‘t break later?
Can you add a comment/docs to make template implementors aware of this?
To be honest I don't know why we expose the template backend as a "real" backend, but heh. |
How is this preventing a unbound local? |
The unbound local comes from the fact that previously, |
With the caveat that I don't know the codebase, it seems to me that UnboundLocals need to be fixed in the code structure itself and should not be allowed to happen, regardless of what a canvas should do vs actually does. I also agree with @timhoffm that a test should be added, especially since based on comments in #17730 skimage might move to Agg for this check, which means we wouldn't be implicitly testing this for you in the future. 😬 |
We rely on print_foo actually walking through the Figure tree (which any non-trivial canvas should likely do...).
Got rid of the UnboundLocalError (in favor of a RuntimeError). Someone else gets to write the test if you really want it... (I'd think we should just run a full test suite against all of backend_template (which is completely untested) if we really want to support that, rather than doing so in a piecemeal fashion). |
Pushed a second commit that fixes #17744. May be better to rewrite _get_output_canvas() to be a context-manager that auto-restores the original canvas at exit, but let's keep that for later (also, name suggestions would be welcome). |
Oh, I forgot about the testing stuff, oh well. |
…731-on-v3.3.x Backport PR #17731 on branch v3.3.x ("Fix" tight_layout for template backend.)
We rely on print_foo actually walking through the Figure tree (which any
non-trivial canvas should likely do...).
Closes #17730.
PR Summary
PR Checklist