Repository navigation
Workaround for islice int error in animation.py - #8984
Conversation
| # itertools.islice can return an error when passed a numpy int instead | ||
| # of a native python int. This is a known issue:http://bugs.python.org/issue30537 | ||
| # As a workaround, enforce conversion to native python int | ||
| self.save_count = int(self.save_count) |
There was a problem hiding this comment.
I would do the conversion in __init__ (after the check for None). Also needs a space after the colon in the comment just above.
|
The travis test is confused by save_count being None type at the outset, but then changing to some kind of number before the int conversion happens. I'm not sure what's happening with the other ones. |
|
|
|
To make @anntzer 's comment a bit clearer 😁, you're missing |
dopplershift
left a comment
There was a problem hiding this comment.
Still have some issues on where the attribute is set on self. I've suggested a different way that should work.
| # of a native python int. This is a known issue: | ||
| # http://bugs.python.org/issue30537 | ||
| # As a workaround, enforce conversion to native python int. | ||
| self.save_count = int(self.save_count) |
There was a problem hiding this comment.
I think you need to do the whole block, like:
if save_count is None:
self.save_count = 100
else:
self.save_count = int(save_count)
dopplershift
left a comment
There was a problem hiding this comment.
Tests are still failing since there are code paths where self.save_count hasn't been set.
| # Amount of framedata to keep around for saving movies. This is only | ||
| # used if we don't know how many frames there will be: in the case | ||
| # of no generator or in the case of a callable. | ||
| self.save_count = save_count |
There was a problem hiding this comment.
Might be easiest just to leave this line, and then do the forced conversion where you do it below.
|
@braaannigan Thanks and congratulations on your first Matplotilb PR 🎉 Hopefully we will hear from you again! |
|
Thanks for your patience guys, took me a while to find the errors in the test reports. |
|
@braaannigan No worries, we have all been there. |
itertools.islice may raise an error when passed a numpy int instead of a native python int.
This is a known issue:http://bugs.python.org/issue30537
As a workaround, enforce conversion of self.save_count to native python int in new_saved_frame_seq():
self.save_count = int(self.save_count)