https://github.com/python/cpython/commit/1dd8e14724a74f189bfc330dd1b5ed2c8264c226
commit: 1dd8e14724a74f189bfc330dd1b5ed2c8264c226
branch: 3.15
author: Miss Islington (bot) <[email protected]>
committer: pablogsal <[email protected]>
date: 2026-11-18T15:40:57Z
summary:

[3.15] gh-149584: Read remote stack chunks without the page cache (GH-160888) 
(GH-162211)

Read stack chunks directly in the sampling profiler. Avoid the page cache retry 
that can read a replacement chunk after the target process reuses the same 
address.

(cherry picked from commit 355486e62b8c6aa06ad5858bede24f464220a097)

Co-authored-by: Maurycy Pawłowski-Wieroński <[email protected]>

files:
A Misc/NEWS.d/next/Library/2026-11-18-12-18-53.gh-issue-149584.rDchNk.rst
M Modules/_remote_debugging/frames.c

diff --git 
a/Misc/NEWS.d/next/Library/2026-11-18-12-18-53.gh-issue-149584.rDchNk.rst 
b/Misc/NEWS.d/next/Library/2026-11-18-12-18-53.gh-issue-149584.rDchNk.rst
new file mode 100644
index 00000000000000..2d0e9d203cf6b3
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2026-11-18-12-18-53.gh-issue-149584.rDchNk.rst
@@ -0,0 +1,3 @@
+Read stack chunks directly in :mod:`profiling.sampling`, without the page
+cache. This removes a redundant retry on macOS that can read a replacement
+chunk after the target process reuses the same address.
diff --git a/Modules/_remote_debugging/frames.c 
b/Modules/_remote_debugging/frames.c
index dc61330084a028..76142c158629d2 100644
--- a/Modules/_remote_debugging/frames.c
+++ b/Modules/_remote_debugging/frames.c
@@ -36,7 +36,7 @@ process_single_stack_chunk(
         return -1;
     }
 
-    if (_Py_RemoteDebug_PagedReadRemoteMemory(&unwinder->handle, chunk_addr, 
current_size, this_chunk) < 0) {
+    if (_Py_RemoteDebug_ReadRemoteMemory(&unwinder->handle, chunk_addr, 
current_size, this_chunk) < 0) {
         PyMem_RawFree(this_chunk);
         set_exception_cause(unwinder, PyExc_RuntimeError, "Failed to read 
stack chunk");
         return -1;
@@ -65,7 +65,7 @@ process_single_stack_chunk(
         }
         this_chunk = tmp;
 
-        if (_Py_RemoteDebug_PagedReadRemoteMemory(&unwinder->handle, 
chunk_addr, actual_size, this_chunk) < 0) {
+        if (_Py_RemoteDebug_ReadRemoteMemory(&unwinder->handle, chunk_addr, 
actual_size, this_chunk) < 0) {
             PyMem_RawFree(this_chunk);
             set_exception_cause(unwinder, PyExc_RuntimeError, "Failed to 
reread stack chunk with correct size");
             return -1;

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to