-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
fix leaked exception in RRuleLocator.tick_values #9025
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
lib/matplotlib/tests/test_dates.py
Outdated
def test_RRuleLocator_dayrange(): | ||
ret = 0 | ||
|
||
try: |
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.
You do not need the try...except
here. If it raises, then the test will fail (but the exception will be caught and the rest of the test suite will run).
Just a comment about how this is just testing 'does not raise' is enough.
Thank you for your work on this! The test failure is a style violation (just some trailing whitespace).
I left a comment on the test, it can be simplified a bit. In general 👍 . If you have any questions please ask! |
@tacaswell Thanks for your reviewing! I've updated the pull request as requested. Does the travis-ci job for this project check every snapshot for a pull request, or only check for the latest one? |
Thanks @gnaggnoyil ! I think this was your first Matplotlib PR, congratulations 🎉 Hopefully we will hear from you again! To answer your question about travis, it triggers on every push to the PR branch an runs on the merge of the tip of the branch into the current master branch. |
The
tick_values
method ofRRuleLocator
inmatlotlib.dates
module usesdateutil
module to calculate the datetime padding in an axis and in case the padding go out of leftist bound it will be set tonum2date(1.0)
. However, in the case when the calculation of datetime goes out of bound, not only theValueError
will be thrown, but alsoOverflowError
will. Not catchingOverflowError
would cause this exception to propagate through the call stack and ultimately prevent the main program from executing. This patch is intended to fix the bug, and a case that would cause this bug is added in test_dates.py intest_RRuleLocator_dayrange
function.