summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/Python/perf_trampoline.c
diff options
context:
space:
mode:
authorshadchin <[email protected]>2026-05-07 07:27:37 +0300
committershadchin <[email protected]>2026-05-07 07:57:26 +0300
commitcdd663c58847eced4c810b05edda251c70a10438 (patch)
tree268b4bf9860a9c77564d93a803d7ecfedd3586cd /contrib/tools/python3/Python/perf_trampoline.c
parentb6f47db70a8a8e904e3f38bed557097ff00f0b3b (diff)
Update Python 3 to 3.13.13
commit_hash:526db1f6570443324e2690db042314848cd47d2e
Diffstat (limited to 'contrib/tools/python3/Python/perf_trampoline.c')
-rw-r--r--contrib/tools/python3/Python/perf_trampoline.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/contrib/tools/python3/Python/perf_trampoline.c b/contrib/tools/python3/Python/perf_trampoline.c
index 5589ec1c362..7ef9eca11f5 100644
--- a/contrib/tools/python3/Python/perf_trampoline.c
+++ b/contrib/tools/python3/Python/perf_trampoline.c
@@ -620,6 +620,12 @@ _PyPerfTrampoline_AfterFork_Child(void)
int was_active = _PyIsPerfTrampolineActive();
_PyPerfTrampoline_Fini();
if (was_active) {
+ // After fork, Fini may leave the old code watcher registered
+ // if trampolined code objects from the parent still exist
+ // (trampoline_refcount > 0). Clear it unconditionally before
+ // Init registers a new one, to prevent two watchers sharing
+ // the same globals and double-decrementing trampoline_refcount.
+ perf_trampoline_reset_state();
_PyPerfTrampoline_Init(1);
}
}