`asyncio.get_event_loop` raises error instead of spawning new loop when no loop is running.
還沒有人認領這個 Issue。
評估
研究方向
在安裝了 uvloop 的情況下重現 Python 程式碼片段,然後檢查 uvloop/init.py 中連結方法附近的 get_event_loop 覆寫。將其行為與未套用 patch 的 asyncio 進行比較;當在沒有正在執行的 loop 時呼叫 asyncio.get_event_loop() 在兩種情況下都具有預期行為時,該 issue 就完成了。
由索引模型根據 Issue 內容生成。
描述
>>> 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.
- 主要語言
- Cython
- 星號
- 11.9k
- 分支
- 615
- PR 合併指標
- 30 天內沒有已合併 PR
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
MagicStack/uvloop 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 68/100
MagicStack/uvloop#759 ·
-
難度 2/5 1-3 小時 新手友好度 68/100
MagicStack/uvloop#741 · 2 個 reaction ·
-
難度 3/5 1-2 天 新手友好度 68/100
MagicStack/uvloop#763 ·
-
難度 3/5 1-2 天 新手友好度 68/100
MagicStack/uvloop#760 ·
-
難度 4/5 3-5 天 新手友好度 48/100
MagicStack/uvloop#754 · 1 則留言 · 1 個 reaction ·
查看 MagicStack/uvloop 的全部 Issue
相似的 Issue
-
area/sessions comp/cron comp/gateway P2 sweeper:risk-message-delivery sweeper:risk-session-state type/bug
難度 2/5 1-3 小時 新手友好度 78/100
NousResearch/hermes-agent#118863 ·
-
難度 2/5 1-3 小時 新手友好度 76/100
-
難度 2/5 1-3 小時 新手友好度 78/100
use-agent-os/agent-os#3312 ·
-
難度 2/5 1-3 小時 新手友好度 85/100
-
needs-acceptance wg/data-plane-networking
難度 2/5 1-3 小時 新手友好度 78/100
vllm-project/semantic-router#4024 · 1 則留言 ·