Skip to content

fix: guard debug stack walk#716

Open
windsornguyen wants to merge 3 commits intoMagicStack:masterfrom
windsornguyen:fix/py314-debug-stack
Open

fix: guard debug stack walk#716
windsornguyen wants to merge 3 commits intoMagicStack:masterfrom
windsornguyen:fix/py314-debug-stack

Conversation

@windsornguyen
Copy link

Summary

Guard uvloop’s debug stack capture on Python 3.14 by walking frames defensively instead of calling traceback.walk_stack() directly. This avoids AttributeError / segfaults when async generator finalization surfaces non‑frame objects (e.g. _asyncio.TaskStepMethWrapper) under debug mode.

Details

  • Replaces traceback.walk_stack() with a simple f_back walk that only includes frames with f_lineno and f_code.
  • Keeps debug stack capture intact while preventing crashes.

Repro (from #715)

Enable debug mode and run an async‑generator chain that finalizes under uvloop:

  • PYTHONASYNCIODEBUG=1
  • Python 3.14 + uvloop 0.22.1

See issue #715 for the minimal script and traceback.

Tests

  • python3 -m pytest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant