mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	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:
		
							parent
							
								
									f7ac656c8e
								
							
						
					
					
						commit
						dd6d24e9d2
					
				
					 4 changed files with 22 additions and 6 deletions
				
			
		| 
						 | 
					@ -505,6 +505,10 @@ Configuration Options
 | 
				
			||||||
     - :c:member:`use_hash_seed <PyConfig.use_hash_seed>`
 | 
					     - :c:member:`use_hash_seed <PyConfig.use_hash_seed>`
 | 
				
			||||||
     - ``bool``
 | 
					     - ``bool``
 | 
				
			||||||
     - Read-only
 | 
					     - Read-only
 | 
				
			||||||
 | 
					   * - ``"use_system_logger"``
 | 
				
			||||||
 | 
					     - :c:member:`use_system_logger <PyConfig.use_system_logger>`
 | 
				
			||||||
 | 
					     - ``bool``
 | 
				
			||||||
 | 
					     - Read-only
 | 
				
			||||||
   * - ``"user_site_directory"``
 | 
					   * - ``"user_site_directory"``
 | 
				
			||||||
     - :c:member:`user_site_directory <PyConfig.user_site_directory>`
 | 
					     - :c:member:`user_site_directory <PyConfig.user_site_directory>`
 | 
				
			||||||
     - ``bool``
 | 
					     - ``bool``
 | 
				
			||||||
| 
						 | 
					@ -1927,9 +1931,10 @@ PyConfig
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      Only available on macOS 10.12 and later, and on iOS.
 | 
					      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
 | 
					   .. c:member:: int user_site_directory
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -297,7 +297,7 @@ To add Python to an iOS Xcode project:
 | 
				
			||||||
   * Writing bytecode (:c:member:`PyConfig.write_bytecode`) is *disabled*;
 | 
					   * Writing bytecode (:c:member:`PyConfig.write_bytecode`) is *disabled*;
 | 
				
			||||||
   * Signal handlers (:c:member:`PyConfig.install_signal_handlers`) are *enabled*;
 | 
					   * Signal handlers (:c:member:`PyConfig.install_signal_handlers`) are *enabled*;
 | 
				
			||||||
   * System logging (:c:member:`PyConfig.use_system_logger`) is *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
 | 
					   * ``PYTHONHOME`` for the interpreter is configured to point at the
 | 
				
			||||||
     ``python`` subfolder of your app's bundle; and
 | 
					     ``python`` subfolder of your app's bundle; and
 | 
				
			||||||
   * The ``PYTHONPATH`` for the interpreter includes:
 | 
					   * The ``PYTHONPATH`` for the interpreter includes:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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.
 | 
				
			||||||
| 
						 | 
					@ -25,6 +25,15 @@
 | 
				
			||||||
#  endif
 | 
					#  endif
 | 
				
			||||||
#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"
 | 
					#include "config_common.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* --- PyConfig setters ------------------------------------------- */
 | 
					/* --- PyConfig setters ------------------------------------------- */
 | 
				
			||||||
| 
						 | 
					@ -1017,7 +1026,7 @@ _PyConfig_InitCompatConfig(PyConfig *config)
 | 
				
			||||||
    config->code_debug_ranges = 1;
 | 
					    config->code_debug_ranges = 1;
 | 
				
			||||||
    config->cpu_count = -1;
 | 
					    config->cpu_count = -1;
 | 
				
			||||||
#ifdef __APPLE__
 | 
					#ifdef __APPLE__
 | 
				
			||||||
    config->use_system_logger = 0;
 | 
					    config->use_system_logger = USE_SYSTEM_LOGGER_DEFAULT;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef Py_GIL_DISABLED
 | 
					#ifdef Py_GIL_DISABLED
 | 
				
			||||||
    config->enable_gil = _PyConfig_GIL_DEFAULT;
 | 
					    config->enable_gil = _PyConfig_GIL_DEFAULT;
 | 
				
			||||||
| 
						 | 
					@ -1049,7 +1058,7 @@ config_init_defaults(PyConfig *config)
 | 
				
			||||||
    config->legacy_windows_stdio = 0;
 | 
					    config->legacy_windows_stdio = 0;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef __APPLE__
 | 
					#ifdef __APPLE__
 | 
				
			||||||
    config->use_system_logger = 0;
 | 
					    config->use_system_logger = USE_SYSTEM_LOGGER_DEFAULT;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1086,7 +1095,7 @@ PyConfig_InitIsolatedConfig(PyConfig *config)
 | 
				
			||||||
    config->legacy_windows_stdio = 0;
 | 
					    config->legacy_windows_stdio = 0;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
#ifdef __APPLE__
 | 
					#ifdef __APPLE__
 | 
				
			||||||
    config->use_system_logger = 0;
 | 
					    config->use_system_logger = USE_SYSTEM_LOGGER_DEFAULT;
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue