Skip to content

Instantly share code, notes, and snippets.

@devdanzin
Created March 18, 2026 10:07
Show Gist options
  • Select an option

  • Save devdanzin/196f041a81611b2fbff22684b2f7166e to your computer and use it in GitHub Desktop.

Select an option

Save devdanzin/196f041a81611b2fbff22684b2f7166e to your computer and use it in GitHub Desktop.
object.c: PyObject_Print missing _Py_LeaveRecursiveCall

object.c: PyObject_Print missing _Py_LeaveRecursiveCall

Summary

PyObject_Print calls _Py_EnterRecursiveCall at line 639 but never calls _Py_LeaveRecursiveCall on the normal return path (line 691). Every successful call permanently increments the recursion depth counter. C API only — not directly callable from Python.

Fix

Add _Py_LeaveRecursiveCall(); before return ret; at line 691.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment