gh-130940: Modify default behavior of PyConfig.use_system_logger to enable on iOS (#131172)

Modify default behavior of use_system_log to enable on iOS.
This commit is contained in:
Russell Keith-Magee 2025-03-13 14:28:49 +08:00 committed by GitHub
parent f7ac656c8e
commit dd6d24e9d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 22 additions and 6 deletions

View file

@ -25,6 +25,15 @@
# endif
#endif
#ifdef __APPLE__
/* Enable system log by default on non-macOS Apple platforms */
# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
#define USE_SYSTEM_LOGGER_DEFAULT 1;
# else
#define USE_SYSTEM_LOGGER_DEFAULT 0;
# endif
#endif
#include "config_common.h"
/* --- PyConfig setters ------------------------------------------- */
@ -1017,7 +1026,7 @@ _PyConfig_InitCompatConfig(PyConfig *config)
config->code_debug_ranges = 1;
config->cpu_count = -1;
#ifdef __APPLE__
config->use_system_logger = 0;
config->use_system_logger = USE_SYSTEM_LOGGER_DEFAULT;
#endif
#ifdef Py_GIL_DISABLED
config->enable_gil = _PyConfig_GIL_DEFAULT;
@ -1049,7 +1058,7 @@ config_init_defaults(PyConfig *config)
config->legacy_windows_stdio = 0;
#endif
#ifdef __APPLE__
config->use_system_logger = 0;
config->use_system_logger = USE_SYSTEM_LOGGER_DEFAULT;
#endif
}
@ -1086,7 +1095,7 @@ PyConfig_InitIsolatedConfig(PyConfig *config)
config->legacy_windows_stdio = 0;
#endif
#ifdef __APPLE__
config->use_system_logger = 0;
config->use_system_logger = USE_SYSTEM_LOGGER_DEFAULT;
#endif
}