Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f6e282b

Browse filesBrowse files
committed
FIX: Event loop timers should only run for the specified time
The implementation of start_event_loop would previously just count the number of sleeps that occurred. But this could lead to longer event loop times if flush_events() added time into the loop. We want the condition to be dependent on the end-time so we don't run our loop longer than necessary.
1 parent 0f6a157 commit f6e282b
Copy full SHA for f6e282b

File tree

1 file changed

+2
-4
lines changed
Filter options

1 file changed

+2
-4
lines changed

‎lib/matplotlib/backend_bases.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backend_bases.py
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2321,12 +2321,10 @@ def start_event_loop(self, timeout=0):
23212321
if timeout <= 0:
23222322
timeout = np.inf
23232323
timestep = 0.01
2324-
counter = 0
2325-
self._looping = True
2326-
while self._looping and counter * timestep < timeout:
2324+
t_end = time.time() + timeout
2325+
while time.time() < t_end:
23272326
self.flush_events()
23282327
time.sleep(timestep)
2329-
counter += 1
23302328

23312329
def stop_event_loop(self):
23322330
"""

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.