Skip to content

Commit 8866eff

Browse files
committed
MNT: Ensure positive interval for timers
Some backends don't handle 0 interval timers, so we can just set a minimum of 1 millisecond for the resolution of the timer to ensure a positive interval passed to all backend timers.
1 parent 83cd2cd commit 8866eff

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/matplotlib/backend_bases.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1164,7 +1164,8 @@ def interval(self):
11641164
def interval(self, interval):
11651165
# Force to int since none of the backends actually support fractional
11661166
# milliseconds, and some error or give warnings.
1167-
interval = int(interval)
1167+
# Some backends also fail when interval == 0, so ensure >= 1 msec
1168+
interval = max(int(interval), 1)
11681169
self._interval = interval
11691170
self._timer_set_interval()
11701171

0 commit comments

Comments
 (0)