Skip to content

Python 3.13 Error Walking Stack w/ PYTHONASYNCIODEBUG=1 #730

@atulenko

Description

@atulenko

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

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', '<not set>')}")

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")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions