https://github.com/python/cpython/commit/373bc1abdf0efed2c9f0e0962e264285ab530c90
commit: 373bc1abdf0efed2c9f0e0962e264285ab530c90
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: pablogsal <[email protected]>
date: 2026-09-19T16:45:19Z
summary:

[3.14] gh-157549: Use sysconf() for the page size in remote_debug.h (GH-157800) 
(#157814)

gh-157549: Use sysconf() for the page size in remote_debug.h (GH-157800)

getpagesize() is not an ISO C or POSIX function. Darwin hides the prototype 
under -std=c11, so the _remote_debugging build fails with 
-Werror=implicit-function-declaration. That is the failure in the reported 
x86_64-apple-darwin → arm64-apple-darwin cross build.

Call sysconf(_SC_PAGESIZE) instead, which is already how resource.getpagesize() 
works. Fall back to 4096 if sysconf() fails.

--without-remote-debug is unchanged. That flag only disables the target-side 
attach protocol (Py_REMOTE_DEBUG); it does not exclude the _remote_debugging 
client module.
(cherry picked from commit 9193375382fbfc871a8a1c14f918895081e219a1)

Co-authored-by: ノウラ | Flare <[email protected]>

files:
A Misc/NEWS.d/next/Build/2026-09-19-16-54-58.gh-issue-157549.uk6QNH.rst
M Python/remote_debug.h

diff --git 
a/Misc/NEWS.d/next/Build/2026-09-19-16-54-58.gh-issue-157549.uk6QNH.rst 
b/Misc/NEWS.d/next/Build/2026-09-19-16-54-58.gh-issue-157549.uk6QNH.rst
new file mode 100644
index 000000000000000..eab0335aa671148
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2026-09-19-16-54-58.gh-issue-157549.uk6QNH.rst
@@ -0,0 +1,3 @@
+Use ``sysconf(_SC_PAGESIZE)`` instead of ``getpagesize()`` in
+``remote_debug.h`` so ``_remote_debugging`` builds on Darwin with
+``-Werror=implicit-function-declaration``.
diff --git a/Python/remote_debug.h b/Python/remote_debug.h
index ed0c4e2c85c37d7..6a1020ff89a2520 100644
--- a/Python/remote_debug.h
+++ b/Python/remote_debug.h
@@ -125,7 +125,8 @@ get_page_size(void) {
         GetSystemInfo(&si);
         page_size = si.dwPageSize;
 #else
-        page_size = (size_t)getpagesize();
+        long n = sysconf(_SC_PAGESIZE);
+        page_size = (n > 0) ? (size_t)n : 4096;
 #endif
     }
     return page_size;

_______________________________________________
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