• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:fail +full:- +full:env +full:- +full:changed

10     (((LEN) == -2) \
20 /* --- File system encoding/errors -------------------------------- */
26 are encoded to UTF-8. */
53 return -1; in _Py_SetFileSystemEncoding()
59 return -1; in _Py_SetFileSystemEncoding()
73 /* --- _PyArgv ---------------------------------------------------- */
80 if (args->use_bytes_argv) { in _PyArgv_AsWstrList()
81 size_t size = sizeof(wchar_t*) * args->argc; in _PyArgv_AsWstrList()
87 for (Py_ssize_t i = 0; i < args->argc; i++) { in _PyArgv_AsWstrList()
89 wchar_t *arg = Py_DecodeLocale(args->bytes_argv[i], &len); in _PyArgv_AsWstrList()
103 wargv.length = args->argc; in _PyArgv_AsWstrList()
104 wargv.items = (wchar_t **)args->wchar_argv; in _PyArgv_AsWstrList()
113 /* --- _PyPreCmdline ------------------------------------------------- */
118 _PyWideStringList_Clear(&cmdline->argv); in _PyPreCmdline_Clear()
119 _PyWideStringList_Clear(&cmdline->xoptions); in _PyPreCmdline_Clear()
126 return _PyArgv_AsWstrList(args, &cmdline->argv); in _PyPreCmdline_SetArgv()
134 if (config->ATTR != -1) { \ in precmdline_get_preconfig()
135 cmdline->ATTR = config->ATTR; \ in precmdline_get_preconfig()
150 config->ATTR = cmdline->ATTR in precmdline_set_preconfig()
164 config->ATTR = cmdline->ATTR in _PyPreCmdline_SetConfig()
166 PyStatus status = _PyWideStringList_Extend(&config->xoptions, &cmdline->xoptions); in _PyPreCmdline_SetConfig()
184 const PyWideStringList *argv = &cmdline->argv; in precmdline_parse_cmdline()
191 int longindex = -1; in precmdline_parse_cmdline()
192 int c = _PyOS_GetOpt(argv->length, argv->items, &longindex); in precmdline_parse_cmdline()
200 cmdline->use_environment = 0; in precmdline_parse_cmdline()
204 cmdline->isolated = 1; in precmdline_parse_cmdline()
209 PyStatus status = PyWideStringList_Append(&cmdline->xoptions, in precmdline_parse_cmdline()
233 if (preconfig->parse_argv) { in _PyPreCmdline_Read()
241 if (cmdline->isolated < 0) { in _PyPreCmdline_Read()
242 cmdline->isolated = 0; in _PyPreCmdline_Read()
244 if (cmdline->isolated > 0) { in _PyPreCmdline_Read()
245 cmdline->use_environment = 0; in _PyPreCmdline_Read()
247 if (cmdline->use_environment < 0) { in _PyPreCmdline_Read()
248 cmdline->use_environment = 0; in _PyPreCmdline_Read()
252 if ((cmdline->dev_mode < 0) in _PyPreCmdline_Read()
253 && (_Py_get_xoption(&cmdline->xoptions, L"dev") in _PyPreCmdline_Read()
254 || _Py_GetEnv(cmdline->use_environment, "PYTHONDEVMODE"))) in _PyPreCmdline_Read()
256 cmdline->dev_mode = 1; in _PyPreCmdline_Read()
258 if (cmdline->dev_mode < 0) { in _PyPreCmdline_Read()
259 cmdline->dev_mode = 0; in _PyPreCmdline_Read()
262 assert(cmdline->use_environment >= 0); in _PyPreCmdline_Read()
263 assert(cmdline->isolated >= 0); in _PyPreCmdline_Read()
264 assert(cmdline->dev_mode >= 0); in _PyPreCmdline_Read()
270 /* --- PyPreConfig ----------------------------------------------- */
278 config->_config_init = (int)_PyConfig_INIT_COMPAT; in _PyPreConfig_InitCompatConfig()
279 config->parse_argv = 0; in _PyPreConfig_InitCompatConfig()
280 config->isolated = -1; in _PyPreConfig_InitCompatConfig()
281 config->use_environment = -1; in _PyPreConfig_InitCompatConfig()
282 config->configure_locale = 1; in _PyPreConfig_InitCompatConfig()
284 /* bpo-36443: C locale coercion (PEP 538) and UTF-8 Mode (PEP 540) in _PyPreConfig_InitCompatConfig()
287 Py_UTF8Mode=1 enables the UTF-8 mode. PYTHONUTF8 environment variable in _PyPreConfig_InitCompatConfig()
289 config->utf8_mode = 0; in _PyPreConfig_InitCompatConfig()
290 config->coerce_c_locale = 0; in _PyPreConfig_InitCompatConfig()
291 config->coerce_c_locale_warn = 0; in _PyPreConfig_InitCompatConfig()
293 config->dev_mode = -1; in _PyPreConfig_InitCompatConfig()
294 config->allocator = PYMEM_ALLOCATOR_NOT_SET; in _PyPreConfig_InitCompatConfig()
296 config->legacy_windows_fs_encoding = -1; in _PyPreConfig_InitCompatConfig()
306 config->_config_init = (int)_PyConfig_INIT_PYTHON; in PyPreConfig_InitPythonConfig()
307 config->isolated = 0; in PyPreConfig_InitPythonConfig()
308 config->parse_argv = 1; in PyPreConfig_InitPythonConfig()
309 config->use_environment = 1; in PyPreConfig_InitPythonConfig()
310 /* Set to -1 to enable C locale coercion (PEP 538) and UTF-8 Mode (PEP 540) in PyPreConfig_InitPythonConfig()
313 config->coerce_c_locale = -1; in PyPreConfig_InitPythonConfig()
314 config->coerce_c_locale_warn = -1; in PyPreConfig_InitPythonConfig()
315 config->utf8_mode = -1; in PyPreConfig_InitPythonConfig()
317 config->legacy_windows_fs_encoding = 0; in PyPreConfig_InitPythonConfig()
327 config->_config_init = (int)_PyConfig_INIT_ISOLATED; in PyPreConfig_InitIsolatedConfig()
328 config->configure_locale = 0; in PyPreConfig_InitIsolatedConfig()
329 config->isolated = 1; in PyPreConfig_InitIsolatedConfig()
330 config->use_environment = 0; in PyPreConfig_InitIsolatedConfig()
331 config->utf8_mode = 0; in PyPreConfig_InitIsolatedConfig()
332 config->dev_mode = 0; in PyPreConfig_InitIsolatedConfig()
334 config->legacy_windows_fs_encoding = 0; in PyPreConfig_InitIsolatedConfig()
352 _PyConfigInitEnum config_init = (_PyConfigInitEnum)config->_config_init; in _PyPreConfig_InitFromConfig()
372 #define COPY_ATTR(ATTR) config->ATTR = config2->ATTR in preconfig_copy()
404 PyObject *obj = PyLong_FromLong(config->ATTR); \ in _PyPreConfig_AsDict()
406 goto fail; \ in _PyPreConfig_AsDict()
411 goto fail; \ in _PyPreConfig_AsDict()
430 fail: in _PyPreConfig_AsDict()
442 if (config->ATTR != -1) { \ in _PyPreConfig_GetConfig()
443 preconfig->ATTR = config->ATTR; \ in _PyPreConfig_GetConfig()
458 if (config->_config_init != _PyConfig_INIT_COMPAT) { in preconfig_get_global_vars()
464 if (config->ATTR < 0) { \ in preconfig_get_global_vars()
465 config->ATTR = VALUE; \ in preconfig_get_global_vars()
468 if (config->ATTR < 0) { \ in preconfig_get_global_vars()
469 config->ATTR = !(VALUE); \ in preconfig_get_global_vars()
475 config->utf8_mode = Py_UTF8Mode; in preconfig_get_global_vars()
490 if (config->ATTR >= 0) { \ in preconfig_set_global_vars()
491 VAR = config->ATTR; \ in preconfig_set_global_vars()
494 if (config->ATTR >= 0) { \ in preconfig_set_global_vars()
495 VAR = !config->ATTR; \ in preconfig_set_global_vars()
536 return -1; in _Py_str_to_int()
539 return -1; in _Py_str_to_int()
556 /* PYTHONDEBUG=text and PYTHONDEBUG=-2 behave as PYTHONDEBUG=1 */ in _Py_get_env_flag()
568 for (Py_ssize_t i=0; i < xoptions->length; i++) { in _Py_get_xoption()
569 const wchar_t *option = xoptions->items[i]; in _Py_get_xoption()
573 len = (sep - option); in _Py_get_xoption()
590 if (config->legacy_windows_fs_encoding) { in preconfig_init_utf8_mode()
591 config->utf8_mode = 0; in preconfig_init_utf8_mode()
595 if (config->utf8_mode >= 0) { in preconfig_init_utf8_mode()
600 xopt = _Py_get_xoption(&cmdline->xoptions, L"utf8"); in preconfig_init_utf8_mode()
606 config->utf8_mode = 1; in preconfig_init_utf8_mode()
609 config->utf8_mode = 0; in preconfig_init_utf8_mode()
612 return _PyStatus_ERR("invalid -X utf8 option value"); in preconfig_init_utf8_mode()
616 config->utf8_mode = 1; in preconfig_init_utf8_mode()
621 const char *opt = _Py_GetEnv(config->use_environment, "PYTHONUTF8"); in preconfig_init_utf8_mode()
624 config->utf8_mode = 1; in preconfig_init_utf8_mode()
627 config->utf8_mode = 0; in preconfig_init_utf8_mode()
638 if (config->utf8_mode < 0) { in preconfig_init_utf8_mode()
639 /* The C locale and the POSIX locale enable the UTF-8 Mode (PEP 540) */ in preconfig_init_utf8_mode()
645 config->utf8_mode = 1; in preconfig_init_utf8_mode()
650 if (config->utf8_mode < 0) { in preconfig_init_utf8_mode()
651 config->utf8_mode = 0; in preconfig_init_utf8_mode()
660 if (!config->configure_locale) { in preconfig_init_coerce_c_locale()
661 config->coerce_c_locale = 0; in preconfig_init_coerce_c_locale()
662 config->coerce_c_locale_warn = 0; in preconfig_init_coerce_c_locale()
666 const char *env = _Py_GetEnv(config->use_environment, "PYTHONCOERCECLOCALE"); in preconfig_init_coerce_c_locale() local
667 if (env) { in preconfig_init_coerce_c_locale()
668 if (strcmp(env, "0") == 0) { in preconfig_init_coerce_c_locale()
669 if (config->coerce_c_locale < 0) { in preconfig_init_coerce_c_locale()
670 config->coerce_c_locale = 0; in preconfig_init_coerce_c_locale()
673 else if (strcmp(env, "warn") == 0) { in preconfig_init_coerce_c_locale()
674 if (config->coerce_c_locale_warn < 0) { in preconfig_init_coerce_c_locale()
675 config->coerce_c_locale_warn = 1; in preconfig_init_coerce_c_locale()
679 if (config->coerce_c_locale < 0) { in preconfig_init_coerce_c_locale()
680 config->coerce_c_locale = 1; in preconfig_init_coerce_c_locale()
685 /* Test if coerce_c_locale equals to -1 or equals to 1: in preconfig_init_coerce_c_locale()
688 if (config->coerce_c_locale < 0 || config->coerce_c_locale == 1) { in preconfig_init_coerce_c_locale()
691 config->coerce_c_locale = 2; in preconfig_init_coerce_c_locale()
694 config->coerce_c_locale = 0; in preconfig_init_coerce_c_locale()
698 if (config->coerce_c_locale_warn < 0) { in preconfig_init_coerce_c_locale()
699 config->coerce_c_locale_warn = 0; in preconfig_init_coerce_c_locale()
707 if (config->allocator == PYMEM_ALLOCATOR_NOT_SET) { in preconfig_init_allocator()
708 /* bpo-34247. The PYTHONMALLOC environment variable has the priority in preconfig_init_allocator()
709 over PYTHONDEV env var and "-X dev" command line option. in preconfig_init_allocator()
712 const char *envvar = _Py_GetEnv(config->use_environment, "PYTHONMALLOC"); in preconfig_init_allocator()
718 config->allocator = (int)name; in preconfig_init_allocator()
722 if (config->dev_mode && config->allocator == PYMEM_ALLOCATOR_NOT_SET) { in preconfig_init_allocator()
723 config->allocator = PYMEM_ALLOCATOR_DEBUG; in preconfig_init_allocator()
743 _Py_get_env_flag(config->use_environment, in preconfig_read()
744 &config->legacy_windows_fs_encoding, in preconfig_read()
761 assert(config->coerce_c_locale >= 0); in preconfig_read()
762 assert(config->coerce_c_locale_warn >= 0); in preconfig_read()
764 assert(config->legacy_windows_fs_encoding >= 0); in preconfig_read()
766 assert(config->utf8_mode >= 0); in preconfig_read()
767 assert(config->isolated >= 0); in preconfig_read()
768 assert(config->use_environment >= 0); in preconfig_read()
769 assert(config->dev_mode >= 0); in preconfig_read()
777 - command line arguments
778 - environment variables
779 - Py_xxx global configuration variables
780 - the LC_CTYPE locale */
812 if (config->configure_locale) { in _PyPreConfig_Read()
833 int utf8_mode = config->utf8_mode; in _PyPreConfig_Read()
838 status = _PyStatus_ERR("Encoding changed twice while " in _PyPreConfig_Read()
843 /* bpo-34207: Py_DecodeLocale() and Py_EncodeLocale() depend in _PyPreConfig_Read()
845 Py_UTF8Mode = config->utf8_mode; in _PyPreConfig_Read()
847 Py_LegacyWindowsFSEncodingFlag = config->legacy_windows_fs_encoding; in _PyPreConfig_Read()
860 * more capable UTF-8 based alternative. in _PyPreConfig_Read()
866 if (config->coerce_c_locale && !locale_coerced) { in _PyPreConfig_Read()
872 if (utf8_mode == -1) { in _PyPreConfig_Read()
873 if (config->utf8_mode == 1) { in _PyPreConfig_Read()
874 /* UTF-8 Mode enabled */ in _PyPreConfig_Read()
879 if (config->utf8_mode != utf8_mode) { in _PyPreConfig_Read()
889 just keep UTF-8 Mode value. */ in _PyPreConfig_Read()
890 int new_utf8_mode = config->utf8_mode; in _PyPreConfig_Read()
891 int new_coerce_c_locale = config->coerce_c_locale; in _PyPreConfig_Read()
893 config->utf8_mode = new_utf8_mode; in _PyPreConfig_Read()
894 config->coerce_c_locale = new_coerce_c_locale; in _PyPreConfig_Read()
896 /* The encoding changed: read again the configuration in _PyPreConfig_Read()
915 /* Write the pre-configuration:
917 - set the memory allocators
918 - set Py_xxx global configuration variables
919 - set the LC_CTYPE locale (coerce C locale, PEP 538) and set the UTF-8 mode
926 pre-configuration. */
938 /* bpo-34008: Calling this functions after Py_Initialize() ignores in _PyPreConfig_Write()
964 /* Write the new pre-configuration into _PyRuntime */ in _PyPreConfig_Write()