MagicStack / MagicStack/uvloop
Python 3.13 Error Walking Stack w/ PYTHONASYNCIODEBUG=1
还没有人认领这个 Issue。
- 主要语言
- Cython
- 星标
- 11.9k
- 派生
- 616
- PR 合并指标
- 30 天内没有已合并 PR
描述
There appears to be a bug in uvloop for python 3.13 walking the stack when PYTHONASYNCIODEBUG=1 and there are c frames in the stack.
I suspect this is tied to changes in 3.13 with how [python handles frames ](https://docs.python.org/3/whatsnew/3.13.html#whatsnew313-locals-semantics)
To Repro:
Python 3.13
uvloop 0.22.1 (also confirmed it happens
run: `docker build -f Dockerfile.latest -t crash-test-latest . 2>&1 | tail -3 && echo "---" && docker run --rm crash-test-latest 2>&1; echo "exit: $?"`
exits w/ 139
If you go into the dockerfile and set `ENV PYTHONASYNCIODEBUG=` (instead of 1), exits w/ 0
Dockerfile:
```
FROM python:3.13-slim
RUN pip install uvloop==0.22.1
ENV PYTHONASYNCIODEBUG=1
COPY repro.py /repro.py
CMD ["python3", "/repro.py"]
```
Repro.py
```
import asyncio
import sys
import os
print(f"Python: {sys.version}")
print(f"Platform: {sys.platform}")
print(f"PYTHONASYNCIODEBUG: {os.environ.get('PYTHONASYNCIODEBUG', '')}")
import uvloop
print(f"uvloop: {uvloop.__version__}")
async def gen():
yield 1
yield 2
async def main():
x = gen()
await x.__anext__()
# x goes out of scope on function exit
uvloop.install()
asyncio.run(main())
print("NO CRASH")
```
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,使用 Dockerfile.latest 中提供的 repro.py,在 Python 3.13 和 PYTHONASYNCIODEBUG=1 下运行提供的 Docker 复现,然后将其与未设置该变量的环境进行比较。跟踪涉及异步生成器和 C 帧的栈遍历失败;当复现程序在启用调试模式的情况下成功退出时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- backend, networking
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100