[3.13] gh-130940: Remove PyConfig.use_system_logger (#131129)

Removes ``PyConfig.use_system_logger``, resolving an ABI incompatibility introduced in
3.13.2.

Changes the default behavior of iOS to *always* direct stdout/stderr to the system log.
This commit is contained in:
Russell Keith-Magee 2025-03-13 11:53:11 +08:00 committed by GitHub
parent 65b58291b0
commit 589f422d1b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 19 additions and 57 deletions

View file

@ -47,20 +47,15 @@
# include <TargetConditionals.h>
# include <mach-o/loader.h>
// The os_log unified logging APIs were introduced in macOS 10.12, iOS 10.0,
// tvOS 10.0, and watchOS 3.0;
// tvOS 10.0, and watchOS 3.0; we enable the use of the system logger
// automatically on non-macOS platforms.
# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
# define HAS_APPLE_SYSTEM_LOG 1
# elif defined(TARGET_OS_OSX) && TARGET_OS_OSX
# if defined(MAC_OS_X_VERSION_10_12) && MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_12
# define HAS_APPLE_SYSTEM_LOG 1
# else
# define HAS_APPLE_SYSTEM_LOG 0
# endif
# define USE_APPLE_SYSTEM_LOG 1
# else
# define HAS_APPLE_SYSTEM_LOG 0
# define USE_APPLE_SYSTEM_LOG 0
# endif
# if HAS_APPLE_SYSTEM_LOG
# if USE_APPLE_SYSTEM_LOG
# include <os/log.h>
# endif
#endif
@ -92,7 +87,7 @@ static PyStatus init_sys_streams(PyThreadState *tstate);
#ifdef __ANDROID__
static PyStatus init_android_streams(PyThreadState *tstate);
#endif
#if defined(__APPLE__) && HAS_APPLE_SYSTEM_LOG
#if defined(__APPLE__) && USE_APPLE_SYSTEM_LOG
static PyStatus init_apple_streams(PyThreadState *tstate);
#endif
static void wait_for_thread_shutdown(PyThreadState *tstate);
@ -1280,12 +1275,10 @@ init_interp_main(PyThreadState *tstate)
return status;
}
#endif
#if defined(__APPLE__) && HAS_APPLE_SYSTEM_LOG
if (config->use_system_logger) {
status = init_apple_streams(tstate);
if (_PyStatus_EXCEPTION(status)) {
return status;
}
#if defined(__APPLE__) && USE_APPLE_SYSTEM_LOG
status = init_apple_streams(tstate);
if (_PyStatus_EXCEPTION(status)) {
return status;
}
#endif
@ -2971,7 +2964,7 @@ done:
#endif // __ANDROID__
#if defined(__APPLE__) && HAS_APPLE_SYSTEM_LOG
#if defined(__APPLE__) && USE_APPLE_SYSTEM_LOG
static PyObject *
apple_log_write_impl(PyObject *self, PyObject *args)
@ -3032,7 +3025,7 @@ done:
return status;
}
#endif // __APPLE__ && HAS_APPLE_SYSTEM_LOG
#endif // __APPLE__ && USE_APPLE_SYSTEM_LOG
static void