8000 fix leaked exception in RRuleLocator.tick_values by gnaggnoyil · Pull Request #9025 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 4 commits into from
Aug 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
.pydevproject
*.swp
.idea
.vscode/

# Compiled source #
###################
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,12 +840,12 @@ def tick_values(self, vmin, vmax):
# We need to cap at the endpoints of valid datetime
try:
start = vmin - delta
except ValueError:
except (ValueError, OverflowError):
start = _from_ordinalf(1.0)

try:
stop = vmax + delta
except ValueError:
except (ValueError, OverflowError):
# The magic number!
stop = _from_ordinalf(3652059.9999999)

Expand Down
8 changes: 8 additions & 0 deletions lib/matplotlib/tests/test_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ def test_RRuleLocator():
fig.autofmt_xdate()


def test_RRuleLocator_dayrange():
loc = mdates.DayLocator()
x1 = datetime.datetime(year=1, month=1, day=1, tzinfo=pytz.UTC)
y1 = datetime.datetime(year=1, month=1, day=16, tzinfo=pytz.UTC)
loc.tick_values(x1, y1)
# On success, no overflow error shall be thrown


@image_comparison(baseline_images=['DateFormatter_fractionalSeconds'],
extensions=['png'])
def test_DateFormatter():
Expand Down
0