https://github.com/python/cpython/commit/3eab77f28f26bc62433248a518e740864e53fa3c
commit: 3eab77f28f26bc62433248a518e740864e53fa3c
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: freakboy3742 <[email protected]>
date: 2026-06-01T22:48:28Z
summary:

[3.13] gh-150644: Tag Apple system log messages as public. (GH-150645) (#150740)

macOS 26 changed the default visibility of "dynamic" system messages. This
changes the logging strategy to tag all messages as "public" so they are
visible in the system log without special configuration.
(cherry picked from commit 71fc4c66d3e675a5481b6b76e6c707c9b6f1e0e0)

Co-authored-by: Russell Keith-Magee <[email protected]>

files:
A Misc/NEWS.d/next/macOS/2026-05-31-10-40-00.gh-issue-150644.zLWyjj.rst
M Python/pylifecycle.c

diff --git 
a/Misc/NEWS.d/next/macOS/2026-05-31-10-40-00.gh-issue-150644.zLWyjj.rst 
b/Misc/NEWS.d/next/macOS/2026-05-31-10-40-00.gh-issue-150644.zLWyjj.rst
new file mode 100644
index 000000000000000..7452a7c765c0a86
--- /dev/null
+++ b/Misc/NEWS.d/next/macOS/2026-05-31-10-40-00.gh-issue-150644.zLWyjj.rst
@@ -0,0 +1,3 @@
+When system logging is enabled (with ``config.use_system_logger``, messages
+are now tagged as public. This allows the macOS 26 system logger to view
+messages without special configuration.
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 8ba9b2bd006f02b..fbbc38bc8e18860 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -2976,7 +2976,9 @@ apple_log_write_impl(PyObject *self, PyObject *args)
 
     // Pass the user-provided text through explicit %s formatting
     // to avoid % literals being interpreted as a formatting directive.
-    os_log_with_type(OS_LOG_DEFAULT, logtype, "%s", text);
+    // Using {public} ensures "dynamic" string messages are visible
+    // in the log without special configuration.
+    os_log_with_type(OS_LOG_DEFAULT, logtype, "%{public}s", text);
     Py_RETURN_NONE;
 }
 

_______________________________________________
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