https://github.com/python/cpython/commit/3a39e33ee48b3d6630288109ccd87172e8c5c631 commit: 3a39e33ee48b3d6630288109ccd87172e8c5c631 branch: main author: Nadeshiko Manju <m...@manjusaka.me> committer: pablogsal <pablog...@gmail.com> date: 2025-04-25T01:40:01+01:00 summary:
gh-131591: Reset RemoteDebuggerSuupport state after fork (#132793) Co-authored-by: Pablo Galindo Salgado <pablog...@gmail.com> files: A Misc/NEWS.d/next/Core_and_Builtins/2025-04-22-19-00-03.gh-issue-131591.CdEqBr.rst M Modules/posixmodule.c diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2025-04-22-19-00-03.gh-issue-131591.CdEqBr.rst b/Misc/NEWS.d/next/Core_and_Builtins/2025-04-22-19-00-03.gh-issue-131591.CdEqBr.rst new file mode 100644 index 00000000000000..e237649e59207e --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2025-04-22-19-00-03.gh-issue-131591.CdEqBr.rst @@ -0,0 +1 @@ +Reset any :pep:`768` remote debugging pending call in children after :func:`os.fork` calls. diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index b7300def8dc75f..8d7131b2eacf95 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -677,6 +677,14 @@ PyOS_AfterFork_Parent(void) run_at_forkers(interp->after_forkers_parent, 0); } +static void +reset_remotedebug_data(PyThreadState *tstate) +{ + tstate->remote_debugger_support.debugger_pending_call = 0; + memset(tstate->remote_debugger_support.debugger_script_path, 0, MAX_SCRIPT_PATH_SIZE); +} + + void PyOS_AfterFork_Child(void) { @@ -710,6 +718,8 @@ PyOS_AfterFork_Child(void) goto fatal_error; } + reset_remotedebug_data(tstate); + // Remove the dead thread states. We "start the world" once we are the only // thread state left to undo the stop the world call in `PyOS_BeforeFork`. // That needs to happen before `_PyThreadState_DeleteList`, because that _______________________________________________ Python-checkins mailing list -- python-checkins@python.org To unsubscribe send an email to python-checkins-le...@python.org https://mail.python.org/mailman3/lists/python-checkins.python.org/ Member address: arch...@mail-archive.com