Skip to content

Commit 26f1ea7

Browse files
authored
Create an event loop if it doesn't exist (#1857)
Python 3.14 has removed the implicit event loop creation. Announced in https://docs.python.org/dev/whatsnew/3.14.html#id7
1 parent b55c8ad commit 26f1ea7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fsspec/implementations/tests/test_http.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,11 @@ def test_docstring():
443443
def test_async_other_thread(server):
444444
import threading
445445

446-
loop = asyncio.get_event_loop()
446+
try:
447+
loop = asyncio.get_event_loop()
448+
except RuntimeError: # Python 3.14+ codepath
449+
loop = asyncio.new_event_loop()
450+
447451
th = threading.Thread(target=loop.run_forever)
448452

449453
th.daemon = True

0 commit comments

Comments
 (0)