`asyncio.get_event_loop` raises error instead of spawning new loop when no loop is running.
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 68/100
Research direction
Reproduce the Python snippet with uvloop installed, then inspect the get_event_loop override in uvloop/init.py around the linked method. Compare its behavior with unpatched asyncio; the issue is done when calling asyncio.get_event_loop() without a running loop has the expected behavior in both cases.
Written by the indexing model from the issue text.
Description
>>> import uvloop, asyncio
>>> asyncio.get_event_loop()
<_UnixSelectorEventLoop running=False closed=False debug=False>
>>> uvloop.install()
>>> asyncio.get_event_loop()
Traceback (most recent call last):
File "<python-input-4>", line 1, in <module>
asyncio.get_event_loop()
~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.13/site-packages/uvloop/__init__.py", line 206, in get_event_loop
raise RuntimeError(
...<2 lines>...
)
RuntimeError: There is no current event loop in thread 'MainThread'.
>>>
As you can see in the snippet above when run on un-patched asyncio it's returning a new loop. But uvloop raises error because of the method override which was not there in previous version inheriting the original new loop spawning function.
- Dominant language
- Cython
- Stars
- 11.9k
- Forks
- 615
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from MagicStack/uvloop
-
License not clear Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
MagicStack/uvloop#759 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
MagicStack/uvloop#741 · 2 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
MagicStack/uvloop#763 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
MagicStack/uvloop#760 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
MagicStack/uvloop#754 · 1 comment · 1 reaction ·
All issues in MagicStack/uvloop
Similar issues
-
area/sessions comp/cron comp/gateway P2 sweeper:risk-message-delivery sweeper:risk-session-state type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NousResearch/hermes-agent#118863 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
use-agent-os/agent-os#3312 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
-
needs-acceptance wg/data-plane-networking
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
vllm-project/semantic-router#4024 · 1 comment ·