Hasty Briefsbeta

Bilingual

Checking Out CPython 3.14's remote debugging protocol

9 months ago
  • #cpython
  • #python
  • #debugging
  • CPython 3.14 introduces a remote debugging protocol allowing injection of Python code into a running process using `sys.remote_exec(pid, script_path)`.
  • The protocol enables debugging without restarting the program, reducing reliance on hacks or deep CPython internals knowledge.
  • Remote scripts execute within the context of the running program, allowing access to its state and stack traces for debugging.
  • Execution of remote scripts is triggered at specific points in the interpreter's loop, meaning progress in Python land is required for the script to run.
  • Examples include inspecting program state or setting up interactive debugging sessions with tools like `remote_pdb` without suspending the process.
  • The feature lowers the barrier for writing debugging tools, supported by CPython's hooks and reference implementation.