Skip to content

Commit fc4d690

Browse files
authored
Merge pull request #9025 from gnaggnoyil/master
fix leaked exception in RRuleLocator.tick_values
2 parents 63fbdd3 + e289d77 commit fc4d690

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
.pydevproject
1515
*.swp
1616
.idea
17+
.vscode/
1718

1819
# Compiled source #
1920
###################

lib/matplotlib/dates.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -840,12 +840,12 @@ def tick_values(self, vmin, vmax):
840840
# We need to cap at the endpoints of valid datetime
841841
try:
842842
start = vmin - delta
843-
except ValueError:
843+
except (ValueError, OverflowError):
844844
start = _from_ordinalf(1.0)
845845

846846
try:
847847
stop = vmax + delta
848-
except ValueError:
848+
except (ValueError, OverflowError):
849849
# The magic number!
850850
stop = _from_ordinalf(3652059.9999999)
851851

lib/matplotlib/tests/test_dates.py

+8
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,14 @@ def test_RRuleLocator():
128128
fig.autofmt_xdate()
129129

130130

131+
def test_RRuleLocator_dayrange():
132+
loc = mdates.DayLocator()
133+
x1 = datetime.datetime(year=1, month=1, day=1, tzinfo=pytz.UTC)
134+
y1 = datetime.datetime(year=1, month=1, day=16, tzinfo=pytz.UTC)
135+
loc.tick_values(x1, y1)
136+
# On success, no overflow error shall be thrown
137+
138+
131139
@image_comparison(baseline_images=['DateFormatter_fractionalSeconds'],
132140
extensions=['png'])
133141
def test_DateFormatter():

0 commit comments

Comments
 (0)