-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Prevent exception when running animation on Agg backend. #13229
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
Currently, running e.g. the strip_chart example using the agg backend (not a particularly interesting use case, but done in particular by the doc build) causes a "AttributeError: 'FuncAnimation' object has no attribute '_cache_frame_data'" exception. This is fixed by moving the setting of the `_cache_frame_data` attribute to before the `super().__init__` call. Also move the setting of `_init_func` next to the one of `_func`, which seems to be a logical grouping.
How did the Attribute Error find its way into the code base if doc builds are part of the testing suite? |
I think because it occurs in an asynchronous event handler (via CallbackRegistry.process). |
If it's a problem in an example, is it possible to add a test for this? |
May be nice, but I'm not volunteering for that (it's actually a bit of a pain to test (if my interpretation is correct) because the exception is not in the main thread). |
Well but as part of a bug fix I feel that as a general rule we should be introducing a test that makes sure the bug doesn't occur again in the future. |
Generally, if we have to shift initialization of variables in The full traceback is
Apparently |
@dstansby I do agree with your point as a general rule, but it does not change the fact that I don't plan to write a test for this PR (both because the use case is obscur(ish) and the test is a pain to write (if I interpreted it correctly)). |
I, for one, am shocked at the idea that code I wrote a decade ago could be considered fragile. 😈 I can't even get the example to crash with the Agg backend. I say that to agree with the idea that testing may be hard. |
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.
Unless someone can come up with a test that can consistently trigger this, I say we merge the fix and get on with our lives. Perfect being the enemy of good and all that.
Currently, running e.g. the strip_chart example using the agg backend
(not a particularly interesting use case, but done in particular by the
doc build) causes a "AttributeError: 'FuncAnimation' object has no
attribute '_cache_frame_data'" exception.
This is fixed by moving the setting of the
_cache_frame_data
attributeto before the
super().__init__
call.Also move the setting of
_init_func
next to the one of_func
, whichseems to be a logical grouping.
PR Summary
PR Checklist