Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions 9 Doc/c-api/init_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,10 @@ Configuration Options
- :c:member:`use_hash_seed <PyConfig.use_hash_seed>`
- ``bool``
- Read-only
* - ``"use_system_logger"``
- :c:member:`use_system_logger <PyConfig.use_system_logger>`
- ``bool``
- Read-only
* - ``"user_site_directory"``
- :c:member:`user_site_directory <PyConfig.user_site_directory>`
- ``bool``
Expand Down Expand Up @@ -1927,9 +1931,10 @@ PyConfig

Only available on macOS 10.12 and later, and on iOS.

Default: ``0`` (don't use system log).
Default: ``0`` (don't use the system log) on macOS; ``1`` on iOS (use the
system log).

.. versionadded:: 3.13.2
.. versionadded:: 3.14

.. c:member:: int user_site_directory

Expand Down
2 changes: 1 addition & 1 deletion 2 Doc/using/ios.rst
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ To add Python to an iOS Xcode project:
* Writing bytecode (:c:member:`PyConfig.write_bytecode`) is *disabled*;
* Signal handlers (:c:member:`PyConfig.install_signal_handlers`) are *enabled*;
* System logging (:c:member:`PyConfig.use_system_logger`) is *enabled*
(optional, but strongly recommended);
(optional, but strongly recommended; this is enabled by default);
* ``PYTHONHOME`` for the interpreter is configured to point at the
``python`` subfolder of your app's bundle; and
* The ``PYTHONPATH`` for the interpreter includes:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
The behavior of ``PyConfig.use_system_logger`` was modified to be enabled by
default on iOS. It remains disabled by default on macOS.
15 changes: 12 additions & 3 deletions 15 Python/initconfig.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 ------------------------------------------- */
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.