8000 MNT: be more precise in scope of exception handling · matplotlib/matplotlib@2eae445 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2eae445

Browse files
authored
MNT: be more precise in scope of exception handling
1 parent 49ded88 commit 2eae445

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/matplotlib/backends/backend_webagg.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,10 +245,10 @@ def random_ports(port, n):
245245

246246
@classmethod
247247
def start(cls):
248+
import asyncio
248249
try:
249-
import asyncio
250250
asyncio.get_running_loop()
251-
except:
251+
except RuntimeError:
252252
pass
253253
else:
254254
cls.started = True
@@ -294,10 +294,10 @@ def ipython_inline_display(figure):
294294
import tornado.template
295295

296296
WebAggApplication.initialize()
297+
import asyncio
297298
try:
298-
import asyncio
299299
asyncio.get_running_loop()
300-
except:
300+
except RuntimeError:
301301
if not webagg_server_thread.is_alive():
302302
webagg_server_thread.start()
303303

0 commit comments

Comments
 (0)
0