| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5b10b98 commit 5a02e0d
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -60,12 +60,42 @@ typedef struct { | |||
| 60 | 60 | Set to 0 by -E command line option. If set to -1 (default), it is | |
| 61 | 61 | set to !Py_IgnoreEnvironmentFlag. */ | |
| 62 | 62 | int use_environment; | |
| 63 | + | ||
| 64 | + int coerce_c_locale; /* PYTHONCOERCECLOCALE, -1 means unknown */ | ||
| 65 | + int coerce_c_locale_warn; /* PYTHONCOERCECLOCALE=warn */ | ||
| 66 | + | ||
| 67 | + #ifdef MS_WINDOWS | ||
| 68 | + /* If greater than 1, use the "mbcs" encoding instead of the UTF-8 | ||
| 69 | + encoding for the filesystem encoding. | ||
| 70 | + | ||
| 71 | + Set to 1 if the PYTHONLEGACYWINDOWSFSENCODING environment variable is | ||
| 72 | + set to a non-empty string. If set to -1 (default), inherit | ||
| 73 | + Py_LegacyWindowsFSEncodingFlag value. | ||
| 74 | + | ||
| 75 | + See PEP 529 for more details. */ | ||
| 76 | + int legacy_windows_fs_encoding; | ||
| 77 | + #endif | ||
| 78 | + | ||
| 79 | + /* Enable UTF-8 mode? | ||
| 80 | + Set by -X utf8 command line option and PYTHONUTF8 environment variable. | ||
| 81 | + If set to -1 (default), inherit Py_UTF8Mode value. */ | ||
| 82 | + int utf8_mode; | ||
| 63 | 83 | } _PyPreConfig; | |
| 64 | 84 | ||
| 85 | + #ifdef MS_WINDOWS | ||
| 86 | + # define _PyPreConfig_WINDOWS_INIT \ | ||
| 87 | + .legacy_windows_fs_encoding = -1, | ||
| 88 | + #else | ||
| 89 | + # define _PyPreConfig_WINDOWS_INIT | ||
| 90 | + #endif | ||
| 91 | + | ||
| 65 | 92 | #define _PyPreConfig_INIT \ | |
| 66 | 93 | (_PyPreConfig){ \ | |
| 94 | + _PyPreConfig_WINDOWS_INIT \ | ||
| 67 | 95 | .isolated = -1, \ | |
| 68 | - .use_environment = -1} | ||
| 96 | + .use_environment = -1, \ | ||
| 97 | + .coerce_c_locale = -1, \ | ||
| 98 | + .utf8_mode = -1} | ||
| 69 | 99 | ||
| 70 | 100 | ||
| 71 | 101 | /* --- _PyCoreConfig ---------------------------------------------- */ | |
@@ -95,8 +125,6 @@ typedef struct { | |||
| 95 | 125 | int show_alloc_count; /* -X showalloccount */ | |
| 96 | 126 | int dump_refs; /* PYTHONDUMPREFS */ | |
| 97 | 127 | int malloc_stats; /* PYTHONMALLOCSTATS */ | |
| 98 | - int coerce_c_locale; /* PYTHONCOERCECLOCALE, -1 means unknown */ | ||
| 99 | - int coerce_c_locale_warn; /* PYTHONCOERCECLOCALE=warn */ | ||
| 100 | 128 | ||
| 101 | 129 | /* Python filesystem encoding and error handler: | |
| 102 | 130 | sys.getfilesystemencoding() and sys.getfilesystemencodeerrors(). | |
@@ -134,11 +162,6 @@ typedef struct { | |||
| 134 | 162 | char *filesystem_encoding; | |
| 135 | 163 | char *filesystem_errors; | |
| 136 | 164 | ||
| 137 | - /* Enable UTF-8 mode? | ||
| 138 | - Set by -X utf8 command line option and PYTHONUTF8 environment variable. | ||
| 139 | - If set to -1 (default), inherit Py_UTF8Mode value. */ | ||
| 140 | - int utf8_mode; | ||
| 141 | - | ||
| 142 | 165 | wchar_t *pycache_prefix; /* PYTHONPYCACHEPREFIX, -X pycache_prefix=PATH */ | |
| 143 | 166 | ||
| 144 | 167 | wchar_t *program_name; /* Program name, see also Py_GetProgramName() */ | |
@@ -277,16 +300,6 @@ typedef struct { | |||
| 277 | 300 | char *stdio_errors; | |
| 278 | 301 | ||
| 279 | 302 | #ifdef MS_WINDOWS | |
| 280 | - /* If greater than 1, use the "mbcs" encoding instead of the UTF-8 | ||
| 281 | - encoding for the filesystem encoding. | ||
| 282 | - | ||
| 283 | - Set to 1 if the PYTHONLEGACYWINDOWSFSENCODING environment variable is | ||
| 284 | - set to a non-empty string. If set to -1 (default), inherit | ||
| 285 | - Py_LegacyWindowsFSEncodingFlag value. | ||
| 286 | - | ||
| 287 | - See PEP 529 for more details. */ | ||
| 288 | - int legacy_windows_fs_encoding; | ||
| 289 | - | ||
| 290 | 303 | /* If greater than zero, use io.FileIO instead of WindowsConsoleIO for sys | |
| 291 | 304 | standard streams. | |
| 292 | 305 | ||
@@ -340,21 +353,19 @@ typedef struct { | |||
| 340 | 353 | ||
| 341 | 354 | #ifdef MS_WINDOWS | |
| 342 | 355 | # define _PyCoreConfig_WINDOWS_INIT \ | |
| 343 | - .legacy_windows_fs_encoding = -1, \ | ||
| 344 | 356 | .legacy_windows_stdio = -1, | |
| 345 | 357 | #else | |
| 346 | 358 | # define _PyCoreConfig_WINDOWS_INIT | |
| 347 | 359 | #endif | |
| 348 | 360 | ||
| 349 | 361 | #define _PyCoreConfig_INIT \ | |
| 350 | 362 | (_PyCoreConfig){ \ | |
| 363 | + _PyCoreConfig_WINDOWS_INIT \ | ||
| 351 | 364 | .preconfig = _PyPreConfig_INIT, \ | |
| 352 | 365 | .install_signal_handlers = 1, \ | |
| 353 | 366 | .use_hash_seed = -1, \ | |
| 354 | 367 | .faulthandler = -1, \ | |
| 355 | 368 | .tracemalloc = -1, \ | |
| 356 | - .coerce_c_locale = -1, \ | ||
| 357 | - .utf8_mode = -1, \ | ||
| 358 | 369 | .argc = -1, \ | |
| 359 | 370 | .nmodule_search_path = -1, \ | |
| 360 | 371 | .site_import = -1, \ | |
@@ -368,7 +379,6 @@ typedef struct { | |||
| 368 | 379 | .quiet = -1, \ | |
| 369 | 380 | .user_site_directory = -1, \ | |
| 370 | 381 | .buffered_stdio = -1, \ | |
| 371 | - _PyCoreConfig_WINDOWS_INIT \ | ||
| 372 | 382 | ._install_importlib = 1, \ | |
| 373 | 383 | ._check_hash_pycs_mode = "default", \ | |
| 374 | 384 | ._frozen = -1} | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,11 +36,24 @@ PyAPI_FUNC(int) _Py_SetArgcArgv(int argc, wchar_t * const *argv); | |||
| 36 | 36 | ||
| 37 | 37 | /* --- _PyPreConfig ----------------------------------------------- */ | |
| 38 | 38 | ||
| 39 | + PyAPI_FUNC(int) _Py_str_to_int( | ||
| 40 | + const char *str, | ||
| 41 | + int *result); | ||
| 42 | + PyAPI_FUNC(const wchar_t*) _Py_get_xoption( | ||
| 43 | + int nxoption, | ||
| 44 | + wchar_t * const *xoptions, | ||
| 45 | + const wchar_t *name); | ||
| 46 | + | ||
| 39 | 47 | PyAPI_FUNC(void) _PyPreConfig_Clear(_PyPreConfig *config); | |
| 40 | 48 | PyAPI_FUNC(int) _PyPreConfig_Copy(_PyPreConfig *config, | |
| 41 | 49 | const _PyPreConfig *config2); | |
| 42 | 50 | PyAPI_FUNC(void) _PyPreConfig_GetGlobalConfig(_PyPreConfig *config); | |
| 43 | 51 | PyAPI_FUNC(void) _PyPreConfig_SetGlobalConfig(const _PyPreConfig *config); | |
| 52 | + PyAPI_FUNC(const char*) _PyPreConfig_GetEnv(const _PyPreConfig *config, | ||
| 53 | + const char *name); | ||
| 54 | + PyAPI_FUNC(void) _Py_get_env_flag(_PyPreConfig *config, | ||
| 55 | + int *flag, | ||
| 56 | + const char *name); | ||
| 44 | 57 | PyAPI_FUNC(_PyInitError) _PyPreConfig_Read(_PyPreConfig *config); | |
| 45 | 58 | PyAPI_FUNC(int) _PyPreConfig_AsDict(const _PyPreConfig *config, | |
| 46 | 59 | PyObject *dict); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -461,7 +461,7 @@ static int test_init_from_config(void) | |||
| 461 | 461 | ||
| 462 | 462 | putenv("PYTHONUTF8=0"); | |
| 463 | 463 | Py_UTF8Mode = 0; | |
| 464 | - config.utf8_mode = 1; | ||
| 464 | + config.preconfig.utf8_mode = 1; | ||
| 465 | 465 | ||
| 466 | 466 | putenv("PYTHONPYCACHEPREFIX=env_pycache_prefix"); | |
| 467 | 467 | config.pycache_prefix = L"conf_pycache_prefix"; | |
@@ -610,8 +610,8 @@ static int test_init_isolated(void) | |||
| 610 | 610 | config.preconfig.isolated = 1; | |
| 611 | 611 | ||
| 612 | 612 | /* Set coerce_c_locale and utf8_mode to not depend on the locale */ | |
| 613 | - config.coerce_c_locale = 0; | ||
| 614 | - config.utf8_mode = 0; | ||
| 613 | + config.preconfig.coerce_c_locale = 0; | ||
| 614 | + config.preconfig.utf8_mode = 0; | ||
| 615 | 615 | /* Use path starting with "./" avoids a search along the PATH */ | |
| 616 | 616 | config.program_name = L"./_testembed"; | |
| 617 | 617 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments