Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f2bb218

Browse files
committed
fix leaked exception in RRuleLocator.tick_values
1 parent 2bc6b59 commit f2bb218

3 files changed

Lines changed: 19 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,7 @@ 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:

lib/matplotlib/tests/test_dates.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,23 @@ def test_RRuleLocator():
128128
fig.autofmt_xdate()
129129

130130

131+
def test_RRuleLocator_dayrange():
132+
ret = 0
133+
134+
try:
135+
loc = mdates.DayLocator()
136+
x1 = datetime.datetime(year=1, month=1, day=1)
137+
y1 = datetime.datetime(year=1, month=1, day=16)
138+
loc.tick_values(x1, y1)
139+
except OverflowError:
140+
# On success, no overflow error shall be thrown
141+
ret = 1
142+
except:
143+
pass
144+
145+
assert ret == 0
146+
147+
131148
@image_comparison(baseline_images=['DateFormatter_fractionalSeconds'],
132149
extensions=['png'])
133150
def test_DateFormatter():

0 commit comments

Comments
 (0)