Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Python 3.13 Error Walking Stack w/ PYTHONASYNCIODEBUG=1

Open
#730 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python

Research direction

Start by running the provided Docker reproduction from Dockerfile.latest with repro.py under Python 3.13 and PYTHONASYNCIODEBUG=1, then compare it with the environment where the variable is unset. Trace the stack-walking failure involving the async generator and C frames; done means the reproduction exits successfully with debug mode enabled.

Written by the indexing model from the issue text.

Description

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MagicStack/uvloop

All issues in MagicStack/uvloop

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.