Lines Matching refs:config
570 PyConfig_Clear(PyConfig *config) in PyConfig_Clear() argument
578 CLEAR(config->pycache_prefix); in PyConfig_Clear()
579 CLEAR(config->pythonpath_env); in PyConfig_Clear()
580 CLEAR(config->home); in PyConfig_Clear()
581 CLEAR(config->program_name); in PyConfig_Clear()
583 _PyWideStringList_Clear(&config->argv); in PyConfig_Clear()
584 _PyWideStringList_Clear(&config->warnoptions); in PyConfig_Clear()
585 _PyWideStringList_Clear(&config->xoptions); in PyConfig_Clear()
586 _PyWideStringList_Clear(&config->module_search_paths); in PyConfig_Clear()
587 config->module_search_paths_set = 0; in PyConfig_Clear()
589 CLEAR(config->executable); in PyConfig_Clear()
590 CLEAR(config->base_executable); in PyConfig_Clear()
591 CLEAR(config->prefix); in PyConfig_Clear()
592 CLEAR(config->base_prefix); in PyConfig_Clear()
593 CLEAR(config->exec_prefix); in PyConfig_Clear()
594 CLEAR(config->base_exec_prefix); in PyConfig_Clear()
595 CLEAR(config->platlibdir); in PyConfig_Clear()
597 CLEAR(config->filesystem_encoding); in PyConfig_Clear()
598 CLEAR(config->filesystem_errors); in PyConfig_Clear()
599 CLEAR(config->stdio_encoding); in PyConfig_Clear()
600 CLEAR(config->stdio_errors); in PyConfig_Clear()
601 CLEAR(config->run_command); in PyConfig_Clear()
602 CLEAR(config->run_module); in PyConfig_Clear()
603 CLEAR(config->run_filename); in PyConfig_Clear()
604 CLEAR(config->check_hash_pycs_mode); in PyConfig_Clear()
606 _PyWideStringList_Clear(&config->_orig_argv); in PyConfig_Clear()
612 _PyConfig_InitCompatConfig(PyConfig *config) in _PyConfig_InitCompatConfig() argument
614 memset(config, 0, sizeof(*config)); in _PyConfig_InitCompatConfig()
616 config->_config_init = (int)_PyConfig_INIT_COMPAT; in _PyConfig_InitCompatConfig()
617 config->isolated = -1; in _PyConfig_InitCompatConfig()
618 config->use_environment = -1; in _PyConfig_InitCompatConfig()
619 config->dev_mode = -1; in _PyConfig_InitCompatConfig()
620 config->install_signal_handlers = 1; in _PyConfig_InitCompatConfig()
621 config->use_hash_seed = -1; in _PyConfig_InitCompatConfig()
622 config->faulthandler = -1; in _PyConfig_InitCompatConfig()
623 config->tracemalloc = -1; in _PyConfig_InitCompatConfig()
624 config->module_search_paths_set = 0; in _PyConfig_InitCompatConfig()
625 config->parse_argv = 0; in _PyConfig_InitCompatConfig()
626 config->site_import = -1; in _PyConfig_InitCompatConfig()
627 config->bytes_warning = -1; in _PyConfig_InitCompatConfig()
628 config->inspect = -1; in _PyConfig_InitCompatConfig()
629 config->interactive = -1; in _PyConfig_InitCompatConfig()
630 config->optimization_level = -1; in _PyConfig_InitCompatConfig()
631 config->parser_debug= -1; in _PyConfig_InitCompatConfig()
632 config->write_bytecode = -1; in _PyConfig_InitCompatConfig()
633 config->verbose = -1; in _PyConfig_InitCompatConfig()
634 config->quiet = -1; in _PyConfig_InitCompatConfig()
635 config->user_site_directory = -1; in _PyConfig_InitCompatConfig()
636 config->configure_c_stdio = 0; in _PyConfig_InitCompatConfig()
637 config->buffered_stdio = -1; in _PyConfig_InitCompatConfig()
638 config->_install_importlib = 1; in _PyConfig_InitCompatConfig()
639 config->check_hash_pycs_mode = NULL; in _PyConfig_InitCompatConfig()
640 config->pathconfig_warnings = -1; in _PyConfig_InitCompatConfig()
641 config->_init_main = 1; in _PyConfig_InitCompatConfig()
642 config->_isolated_interpreter = 0; in _PyConfig_InitCompatConfig()
644 config->legacy_windows_stdio = -1; in _PyConfig_InitCompatConfig()
646 config->_use_peg_parser = 1; in _PyConfig_InitCompatConfig()
651 config_init_defaults(PyConfig *config) in config_init_defaults() argument
653 _PyConfig_InitCompatConfig(config); in config_init_defaults()
655 config->isolated = 0; in config_init_defaults()
656 config->use_environment = 1; in config_init_defaults()
657 config->site_import = 1; in config_init_defaults()
658 config->bytes_warning = 0; in config_init_defaults()
659 config->inspect = 0; in config_init_defaults()
660 config->interactive = 0; in config_init_defaults()
661 config->optimization_level = 0; in config_init_defaults()
662 config->parser_debug= 0; in config_init_defaults()
663 config->write_bytecode = 1; in config_init_defaults()
664 config->verbose = 0; in config_init_defaults()
665 config->quiet = 0; in config_init_defaults()
666 config->user_site_directory = 1; in config_init_defaults()
667 config->buffered_stdio = 1; in config_init_defaults()
668 config->pathconfig_warnings = 1; in config_init_defaults()
670 config->legacy_windows_stdio = 0; in config_init_defaults()
676 PyConfig_InitPythonConfig(PyConfig *config) in PyConfig_InitPythonConfig() argument
678 config_init_defaults(config); in PyConfig_InitPythonConfig()
680 config->_config_init = (int)_PyConfig_INIT_PYTHON; in PyConfig_InitPythonConfig()
681 config->configure_c_stdio = 1; in PyConfig_InitPythonConfig()
682 config->parse_argv = 1; in PyConfig_InitPythonConfig()
687 PyConfig_InitIsolatedConfig(PyConfig *config) in PyConfig_InitIsolatedConfig() argument
689 config_init_defaults(config); in PyConfig_InitIsolatedConfig()
691 config->_config_init = (int)_PyConfig_INIT_ISOLATED; in PyConfig_InitIsolatedConfig()
692 config->isolated = 1; in PyConfig_InitIsolatedConfig()
693 config->use_environment = 0; in PyConfig_InitIsolatedConfig()
694 config->user_site_directory = 0; in PyConfig_InitIsolatedConfig()
695 config->dev_mode = 0; in PyConfig_InitIsolatedConfig()
696 config->install_signal_handlers = 0; in PyConfig_InitIsolatedConfig()
697 config->use_hash_seed = 0; in PyConfig_InitIsolatedConfig()
698 config->faulthandler = 0; in PyConfig_InitIsolatedConfig()
699 config->tracemalloc = 0; in PyConfig_InitIsolatedConfig()
700 config->pathconfig_warnings = 0; in PyConfig_InitIsolatedConfig()
702 config->legacy_windows_stdio = 0; in PyConfig_InitIsolatedConfig()
709 PyConfig_SetString(PyConfig *config, wchar_t **config_str, const wchar_t *str) in PyConfig_SetString() argument
711 PyStatus status = _Py_PreInitializeFromConfig(config, NULL); in PyConfig_SetString()
733 config_set_bytes_string(PyConfig *config, wchar_t **config_str, in config_set_bytes_string() argument
736 PyStatus status = _Py_PreInitializeFromConfig(config, NULL); in config_set_bytes_string()
763 #define CONFIG_SET_BYTES_STR(config, config_str, str, NAME) \ argument
764 config_set_bytes_string(config, config_str, str, "cannot decode " NAME)
771 PyConfig_SetBytesString(PyConfig *config, wchar_t **config_str, in PyConfig_SetBytesString() argument
774 return CONFIG_SET_BYTES_STR(config, config_str, str, "string"); in PyConfig_SetBytesString()
779 _PyConfig_Copy(PyConfig *config, const PyConfig *config2) in _PyConfig_Copy() argument
783 PyConfig_Clear(config); in _PyConfig_Copy()
785 #define COPY_ATTR(ATTR) config->ATTR = config2->ATTR in _PyConfig_Copy()
788 status = PyConfig_SetString(config, &config->ATTR, config2->ATTR); \ in _PyConfig_Copy()
795 if (_PyWideStringList_Copy(&config->LIST, &config2->LIST) < 0) { \ in _PyConfig_Copy()
873 config_as_dict(const PyConfig *config) in config_as_dict() argument
895 SET_ITEM(#ATTR, PyLong_FromLong(config->ATTR)) in config_as_dict()
897 SET_ITEM(#ATTR, PyLong_FromUnsignedLong(config->ATTR)) in config_as_dict()
903 SET_ITEM(#ATTR, FROM_WSTRING(config->ATTR)) in config_as_dict()
905 SET_ITEM(#LIST, _PyWideStringList_AsList(&config->LIST)) in config_as_dict()
983 config_get_env(const PyConfig *config, const char *name) in config_get_env() argument
985 return _Py_GetEnv(config->use_environment, name); in config_get_env()
993 config_get_env_dup(PyConfig *config, in config_get_env_dup() argument
999 assert(config->use_environment >= 0); in config_get_env_dup()
1001 if (!config->use_environment) { in config_get_env_dup()
1013 return PyConfig_SetString(config, dest, var); in config_get_env_dup()
1021 return config_set_bytes_string(config, dest, var, decode_err_msg); in config_get_env_dup()
1031 config_get_global_vars(PyConfig *config) in config_get_global_vars() argument
1033 if (config->_config_init != _PyConfig_INIT_COMPAT) { in config_get_global_vars()
1039 if (config->ATTR == -1) { \ in config_get_global_vars()
1040 config->ATTR = VALUE; \ in config_get_global_vars()
1043 if (config->ATTR == -1) { \ in config_get_global_vars()
1044 config->ATTR = !(VALUE); \ in config_get_global_vars()
1073 config_set_global_vars(const PyConfig *config) in config_set_global_vars() argument
1076 if (config->ATTR != -1) { \ in config_set_global_vars()
1077 VAR = config->ATTR; \ in config_set_global_vars()
1080 if (config->ATTR != -1) { \ in config_set_global_vars()
1081 VAR = !config->ATTR; \ in config_set_global_vars()
1104 Py_HashRandomizationFlag = (config->use_hash_seed == 0 || in config_set_global_vars()
1105 config->hash_seed != 0); in config_set_global_vars()
1115 config_init_program_name(PyConfig *config) in config_init_program_name() argument
1122 config->program_name = _PyMem_RawWcsdup(program_name); in config_init_program_name()
1123 if (config->program_name == NULL) { in config_init_program_name()
1139 const char *p = config_get_env(config, "PYTHONEXECUTABLE"); in config_init_program_name()
1141 status = CONFIG_SET_BYTES_STR(config, &config->program_name, p, in config_init_program_name()
1155 status = CONFIG_SET_BYTES_STR(config, in config_init_program_name()
1156 &config->program_name, in config_init_program_name()
1180 const PyWideStringList *argv = &config->argv; in config_init_program_name()
1182 config->program_name = _PyMem_RawWcsdup(argv->items[0]); in config_init_program_name()
1183 if (config->program_name == NULL) { in config_init_program_name()
1195 status = PyConfig_SetString(config, &config->program_name, in config_init_program_name()
1204 config_init_executable(PyConfig *config) in config_init_executable() argument
1206 assert(config->executable == NULL); in config_init_executable()
1211 PyStatus status = PyConfig_SetString(config, in config_init_executable()
1212 &config->executable, in config_init_executable()
1224 config_get_xoption(const PyConfig *config, wchar_t *name) in config_get_xoption() argument
1226 return _Py_get_xoption(&config->xoptions, name); in config_get_xoption()
1231 config_init_home(PyConfig *config) in config_init_home() argument
1233 assert(config->home == NULL); in config_init_home()
1238 PyStatus status = PyConfig_SetString(config, &config->home, home); in config_init_home()
1245 return CONFIG_GET_ENV_DUP(config, &config->home, in config_init_home()
1251 config_init_hash_seed(PyConfig *config) in config_init_hash_seed() argument
1253 const char *seed_text = config_get_env(config, "PYTHONHASHSEED"); in config_init_hash_seed()
1270 config->use_hash_seed = 1; in config_init_hash_seed()
1271 config->hash_seed = seed; in config_init_hash_seed()
1275 config->use_hash_seed = 0; in config_init_hash_seed()
1276 config->hash_seed = 0; in config_init_hash_seed()
1301 config_read_env_vars(PyConfig *config) in config_read_env_vars() argument
1304 int use_env = config->use_environment; in config_read_env_vars()
1307 _Py_get_env_flag(use_env, &config->parser_debug, "PYTHONDEBUG"); in config_read_env_vars()
1308 _Py_get_env_flag(use_env, &config->verbose, "PYTHONVERBOSE"); in config_read_env_vars()
1309 _Py_get_env_flag(use_env, &config->optimization_level, "PYTHONOPTIMIZE"); in config_read_env_vars()
1310 _Py_get_env_flag(use_env, &config->inspect, "PYTHONINSPECT"); in config_read_env_vars()
1315 config->write_bytecode = 0; in config_read_env_vars()
1321 config->user_site_directory = 0; in config_read_env_vars()
1327 config->buffered_stdio = 0; in config_read_env_vars()
1331 _Py_get_env_flag(use_env, &config->legacy_windows_stdio, in config_read_env_vars()
1335 if (config_get_env(config, "PYTHONDUMPREFS")) { in config_read_env_vars()
1336 config->dump_refs = 1; in config_read_env_vars()
1338 if (config_get_env(config, "PYTHONMALLOCSTATS")) { in config_read_env_vars()
1339 config->malloc_stats = 1; in config_read_env_vars()
1342 if (config->pythonpath_env == NULL) { in config_read_env_vars()
1343 status = CONFIG_GET_ENV_DUP(config, &config->pythonpath_env, in config_read_env_vars()
1350 if(config->platlibdir == NULL) { in config_read_env_vars()
1351 status = CONFIG_GET_ENV_DUP(config, &config->platlibdir, in config_read_env_vars()
1358 if (config->use_hash_seed < 0) { in config_read_env_vars()
1359 status = config_init_hash_seed(config); in config_read_env_vars()
1370 config_init_tracemalloc(PyConfig *config) in config_init_tracemalloc() argument
1375 const char *env = config_get_env(config, "PYTHONTRACEMALLOC"); in config_init_tracemalloc()
1386 config->tracemalloc = nframe; in config_init_tracemalloc()
1389 const wchar_t *xoption = config_get_xoption(config, L"tracemalloc"); in config_init_tracemalloc()
1408 config->tracemalloc = nframe; in config_init_tracemalloc()
1415 config_init_pycache_prefix(PyConfig *config) in config_init_pycache_prefix() argument
1417 assert(config->pycache_prefix == NULL); in config_init_pycache_prefix()
1419 const wchar_t *xoption = config_get_xoption(config, L"pycache_prefix"); in config_init_pycache_prefix()
1423 config->pycache_prefix = _PyMem_RawWcsdup(sep + 1); in config_init_pycache_prefix()
1424 if (config->pycache_prefix == NULL) { in config_init_pycache_prefix()
1431 config->pycache_prefix = NULL; in config_init_pycache_prefix()
1436 return CONFIG_GET_ENV_DUP(config, &config->pycache_prefix, in config_init_pycache_prefix()
1443 config_read_complex_options(PyConfig *config) in config_read_complex_options() argument
1446 if (config->faulthandler < 0) { in config_read_complex_options()
1447 if (config_get_env(config, "PYTHONFAULTHANDLER") in config_read_complex_options()
1448 || config_get_xoption(config, L"faulthandler")) { in config_read_complex_options()
1449 config->faulthandler = 1; in config_read_complex_options()
1452 if (config_get_env(config, "PYTHONPROFILEIMPORTTIME") in config_read_complex_options()
1453 || config_get_xoption(config, L"importtime")) { in config_read_complex_options()
1454 config->import_time = 1; in config_read_complex_options()
1457 if (config_get_env(config, "PYTHONOLDPARSER") in config_read_complex_options()
1458 || config_get_xoption(config, L"oldparser")) { in config_read_complex_options()
1459 config->_use_peg_parser = 0; in config_read_complex_options()
1463 if (config->tracemalloc < 0) { in config_read_complex_options()
1464 status = config_init_tracemalloc(config); in config_read_complex_options()
1470 if (config->pycache_prefix == NULL) { in config_read_complex_options()
1471 status = config_init_pycache_prefix(config); in config_read_complex_options()
1508 config_get_locale_encoding(PyConfig *config, wchar_t **locale_encoding) in config_get_locale_encoding() argument
1513 return PyConfig_SetBytesString(config, locale_encoding, encoding); in config_get_locale_encoding()
1515 return PyConfig_SetString(config, locale_encoding, L"utf-8"); in config_get_locale_encoding()
1523 return CONFIG_SET_BYTES_STR(config, in config_get_locale_encoding()
1531 config_init_stdio_encoding(PyConfig *config, in config_init_stdio_encoding() argument
1538 if (config->stdio_encoding == NULL && _Py_StandardStreamEncoding != NULL) { in config_init_stdio_encoding()
1539 status = CONFIG_SET_BYTES_STR(config, &config->stdio_encoding, in config_init_stdio_encoding()
1547 if (config->stdio_errors == NULL && _Py_StandardStreamErrors != NULL) { in config_init_stdio_encoding()
1548 status = CONFIG_SET_BYTES_STR(config, &config->stdio_errors, in config_init_stdio_encoding()
1556 if (config->stdio_encoding != NULL && config->stdio_errors != NULL) { in config_init_stdio_encoding()
1561 const char *opt = config_get_env(config, "PYTHONIOENCODING"); in config_init_stdio_encoding()
1579 if (config->stdio_encoding == NULL) { in config_init_stdio_encoding()
1580 status = CONFIG_SET_BYTES_STR(config, &config->stdio_encoding, in config_init_stdio_encoding()
1598 if (config->stdio_errors == NULL && errors != NULL) { in config_init_stdio_encoding()
1599 status = CONFIG_SET_BYTES_STR(config, &config->stdio_errors, in config_init_stdio_encoding()
1613 if (config->stdio_encoding == NULL) { in config_init_stdio_encoding()
1614 status = PyConfig_SetString(config, &config->stdio_encoding, in config_init_stdio_encoding()
1620 if (config->stdio_errors == NULL) { in config_init_stdio_encoding()
1621 status = PyConfig_SetString(config, &config->stdio_errors, in config_init_stdio_encoding()
1630 if (config->stdio_encoding == NULL) { in config_init_stdio_encoding()
1631 status = config_get_locale_encoding(config, &config->stdio_encoding); in config_init_stdio_encoding()
1636 if (config->stdio_errors == NULL) { in config_init_stdio_encoding()
1640 status = PyConfig_SetString(config, &config->stdio_errors, errors); in config_init_stdio_encoding()
1651 config_init_fs_encoding(PyConfig *config, const PyPreConfig *preconfig) in config_init_fs_encoding() argument
1655 if (config->filesystem_encoding == NULL) { in config_init_fs_encoding()
1657 status = PyConfig_SetString(config, &config->filesystem_encoding, L"utf-8"); in config_init_fs_encoding()
1663 status = PyConfig_SetString(config, &config->filesystem_encoding, in config_init_fs_encoding()
1669 status = PyConfig_SetString(config, &config->filesystem_encoding, in config_init_fs_encoding()
1674 status = PyConfig_SetString(config, &config->filesystem_encoding, in config_init_fs_encoding()
1681 status = PyConfig_SetString(config, &config->filesystem_encoding, in config_init_fs_encoding()
1684 status = config_get_locale_encoding(config, in config_init_fs_encoding()
1685 &config->filesystem_encoding); in config_init_fs_encoding()
1695 if (config->filesystem_errors == NULL) { in config_init_fs_encoding()
1707 status = PyConfig_SetString(config, &config->filesystem_errors, errors); in config_init_fs_encoding()
1717 config_read(PyConfig *config) in config_read() argument
1722 if (config->use_environment) { in config_read()
1723 status = config_read_env_vars(config); in config_read()
1730 if (config_get_xoption(config, L"showrefcount")) { in config_read()
1731 config->show_ref_count = 1; in config_read()
1734 status = config_read_complex_options(config); in config_read()
1739 if (config->home == NULL) { in config_read()
1740 status = config_init_home(config); in config_read()
1746 if (config->executable == NULL) { in config_read()
1747 status = config_init_executable(config); in config_read()
1753 if(config->platlibdir == NULL) { in config_read()
1754 status = CONFIG_SET_BYTES_STR(config, &config->platlibdir, PLATLIBDIR, in config_read()
1761 if (config->_install_importlib) { in config_read()
1762 status = _PyConfig_InitPathConfig(config); in config_read()
1769 if (config->dev_mode) { in config_read()
1770 if (config->faulthandler < 0) { in config_read()
1771 config->faulthandler = 1; in config_read()
1774 if (config->faulthandler < 0) { in config_read()
1775 config->faulthandler = 0; in config_read()
1777 if (config->tracemalloc < 0) { in config_read()
1778 config->tracemalloc = 0; in config_read()
1780 if (config->use_hash_seed < 0) { in config_read()
1781 config->use_hash_seed = 0; in config_read()
1782 config->hash_seed = 0; in config_read()
1785 if (config->filesystem_encoding == NULL || config->filesystem_errors == NULL) { in config_read()
1786 status = config_init_fs_encoding(config, preconfig); in config_read()
1792 status = config_init_stdio_encoding(config, preconfig); in config_read()
1797 if (config->argv.length < 1) { in config_read()
1799 status = PyWideStringList_Append(&config->argv, L""); in config_read()
1805 if (config->check_hash_pycs_mode == NULL) { in config_read()
1806 status = PyConfig_SetString(config, &config->check_hash_pycs_mode, in config_read()
1813 if (config->configure_c_stdio < 0) { in config_read()
1814 config->configure_c_stdio = 1; in config_read()
1822 config_init_stdio(const PyConfig *config) in config_init_stdio() argument
1831 if (!config->buffered_stdio) { in config_init_stdio()
1842 else if (config->interactive) { in config_init_stdio()
1863 _PyConfig_Write(const PyConfig *config, _PyRuntimeState *runtime) in _PyConfig_Write() argument
1865 config_set_global_vars(config); in _PyConfig_Write()
1867 if (config->configure_c_stdio) { in _PyConfig_Write()
1868 config_init_stdio(config); in _PyConfig_Write()
1873 preconfig->isolated = config->isolated; in _PyConfig_Write()
1874 preconfig->use_environment = config->use_environment; in _PyConfig_Write()
1875 preconfig->dev_mode = config->dev_mode; in _PyConfig_Write()
1877 if (_Py_SetArgcArgv(config->_orig_argv.length, in _PyConfig_Write()
1878 config->_orig_argv.items) < 0) in _PyConfig_Write()
1909 config_parse_cmdline(PyConfig *config, PyWideStringList *warnoptions, in config_parse_cmdline() argument
1913 const PyWideStringList *argv = &config->argv; in config_parse_cmdline()
1915 const wchar_t* program = config->program_name; in config_parse_cmdline()
1926 if (config->run_command == NULL) { in config_parse_cmdline()
1938 config->run_command = command; in config_parse_cmdline()
1947 if (config->run_module == NULL) { in config_parse_cmdline()
1948 config->run_module = _PyMem_RawWcsdup(_PyOS_optarg); in config_parse_cmdline()
1949 if (config->run_module == NULL) { in config_parse_cmdline()
1964 status = PyConfig_SetString(config, &config->check_hash_pycs_mode, in config_parse_cmdline()
1978 config->bytes_warning++; in config_parse_cmdline()
1982 config->parser_debug++; in config_parse_cmdline()
1986 config->inspect++; in config_parse_cmdline()
1987 config->interactive++; in config_parse_cmdline()
1999 config->optimization_level++; in config_parse_cmdline()
2003 config->write_bytecode = 0; in config_parse_cmdline()
2007 config->user_site_directory = 0; in config_parse_cmdline()
2011 config->site_import = 0; in config_parse_cmdline()
2019 config->buffered_stdio = 0; in config_parse_cmdline()
2023 config->verbose++; in config_parse_cmdline()
2027 config->skip_source_first_line = 1; in config_parse_cmdline()
2047 config->quiet++; in config_parse_cmdline()
2051 config->use_hash_seed = 0; in config_parse_cmdline()
2069 if (config->run_command == NULL && config->run_module == NULL in config_parse_cmdline()
2072 && config->run_filename == NULL) in config_parse_cmdline()
2074 config->run_filename = _PyMem_RawWcsdup(argv->items[_PyOS_optind]); in config_parse_cmdline()
2075 if (config->run_filename == NULL) { in config_parse_cmdline()
2080 if (config->run_command != NULL || config->run_module != NULL) { in config_parse_cmdline()
2099 config_init_env_warnoptions(PyConfig *config, PyWideStringList *warnoptions) in config_init_env_warnoptions() argument
2104 status = CONFIG_GET_ENV_DUP(config, &env, in config_init_env_warnoptions()
2133 warnoptions_append(PyConfig *config, PyWideStringList *options, in warnoptions_append() argument
2140 if (_PyWideStringList_Find(&config->warnoptions, option)) { in warnoptions_append()
2153 warnoptions_extend(PyConfig *config, PyWideStringList *options, in warnoptions_extend() argument
2160 PyStatus status = warnoptions_append(config, options, items[i]); in warnoptions_extend()
2170 config_init_warnoptions(PyConfig *config, in config_init_warnoptions() argument
2195 if (config->dev_mode) { in config_init_warnoptions()
2196 status = warnoptions_append(config, &options, L"default"); in config_init_warnoptions()
2202 status = warnoptions_extend(config, &options, env_warnoptions); in config_init_warnoptions()
2207 status = warnoptions_extend(config, &options, cmdline_warnoptions); in config_init_warnoptions()
2216 if (config->bytes_warning) { in config_init_warnoptions()
2218 if (config->bytes_warning> 1) { in config_init_warnoptions()
2224 status = warnoptions_append(config, &options, filter); in config_init_warnoptions()
2230 status = warnoptions_extend(config, &options, sys_warnoptions); in config_init_warnoptions()
2236 status = _PyWideStringList_Extend(&options, &config->warnoptions); in config_init_warnoptions()
2241 _PyWideStringList_Clear(&config->warnoptions); in config_init_warnoptions()
2242 config->warnoptions = options; in config_init_warnoptions()
2252 config_update_argv(PyConfig *config, Py_ssize_t opt_index) in config_update_argv() argument
2254 const PyWideStringList *cmdline_argv = &config->argv; in config_update_argv()
2276 if (config->run_command != NULL) { in config_update_argv()
2280 else if (config->run_module != NULL) { in config_update_argv()
2296 _PyWideStringList_Clear(&config->argv); in config_update_argv()
2297 config->argv = config_argv; in config_update_argv()
2303 core_read_precmdline(PyConfig *config, _PyPreCmdline *precmdline) in core_read_precmdline() argument
2307 if (config->parse_argv) { in core_read_precmdline()
2308 if (_PyWideStringList_Copy(&precmdline->argv, &config->argv) < 0) { in core_read_precmdline()
2320 _PyPreConfig_GetConfig(&preconfig, config); in core_read_precmdline()
2327 status = _PyPreCmdline_SetConfig(precmdline, config); in core_read_precmdline()
2337 config_run_filename_abspath(PyConfig *config) in config_run_filename_abspath() argument
2339 if (!config->run_filename) { in config_run_filename_abspath()
2344 if (_Py_isabs(config->run_filename)) { in config_run_filename_abspath()
2351 if (_Py_abspath(config->run_filename, &abs_filename) < 0) { in config_run_filename_abspath()
2360 PyMem_RawFree(config->run_filename); in config_run_filename_abspath()
2361 config->run_filename = abs_filename; in config_run_filename_abspath()
2367 config_read_cmdline(PyConfig *config) in config_read_cmdline() argument
2374 if (config->parse_argv < 0) { in config_read_cmdline()
2375 config->parse_argv = 1; in config_read_cmdline()
2378 if (config->program_name == NULL) { in config_read_cmdline()
2379 status = config_init_program_name(config); in config_read_cmdline()
2385 if (config->parse_argv) { in config_read_cmdline()
2387 status = config_parse_cmdline(config, &cmdline_warnoptions, &opt_index); in config_read_cmdline()
2392 status = config_run_filename_abspath(config); in config_read_cmdline()
2397 status = config_update_argv(config, opt_index); in config_read_cmdline()
2403 status = config_run_filename_abspath(config); in config_read_cmdline()
2409 if (config->use_environment) { in config_read_cmdline()
2410 status = config_init_env_warnoptions(config, &env_warnoptions); in config_read_cmdline()
2422 status = config_init_warnoptions(config, in config_read_cmdline()
2441 _PyConfig_SetPyArgv(PyConfig *config, const _PyArgv *args) in _PyConfig_SetPyArgv() argument
2443 PyStatus status = _Py_PreInitializeFromConfig(config, args); in _PyConfig_SetPyArgv()
2448 return _PyArgv_AsWstrList(args, &config->argv); in _PyConfig_SetPyArgv()
2455 PyConfig_SetBytesArgv(PyConfig *config, Py_ssize_t argc, char * const *argv) in PyConfig_SetBytesArgv() argument
2462 return _PyConfig_SetPyArgv(config, &args); in PyConfig_SetBytesArgv()
2467 PyConfig_SetArgv(PyConfig *config, Py_ssize_t argc, wchar_t * const *argv) in PyConfig_SetArgv() argument
2474 return _PyConfig_SetPyArgv(config, &args); in PyConfig_SetArgv()
2479 PyConfig_SetWideStringList(PyConfig *config, PyWideStringList *list, in PyConfig_SetWideStringList() argument
2482 PyStatus status = _Py_PreInitializeFromConfig(config, NULL); in PyConfig_SetWideStringList()
2503 PyConfig_Read(PyConfig *config) in PyConfig_Read() argument
2507 status = _Py_PreInitializeFromConfig(config, NULL); in PyConfig_Read()
2512 config_get_global_vars(config); in PyConfig_Read()
2514 if (config->_orig_argv.length == 0 in PyConfig_Read()
2515 && !(config->argv.length == 1 in PyConfig_Read()
2516 && wcscmp(config->argv.items[0], L"") == 0)) in PyConfig_Read()
2518 if (_PyWideStringList_Copy(&config->_orig_argv, &config->argv) < 0) { in PyConfig_Read()
2524 status = core_read_precmdline(config, &precmdline); in PyConfig_Read()
2529 assert(config->isolated >= 0); in PyConfig_Read()
2530 if (config->isolated) { in PyConfig_Read()
2531 config->use_environment = 0; in PyConfig_Read()
2532 config->user_site_directory = 0; in PyConfig_Read()
2535 status = config_read_cmdline(config); in PyConfig_Read()
2541 status = _PySys_ReadPreinitXOptions(config); in PyConfig_Read()
2546 status = config_read(config); in PyConfig_Read()
2552 assert(config->isolated >= 0); in PyConfig_Read()
2553 assert(config->use_environment >= 0); in PyConfig_Read()
2554 assert(config->dev_mode >= 0); in PyConfig_Read()
2555 assert(config->_use_peg_parser >= 0); in PyConfig_Read()
2556 assert(config->install_signal_handlers >= 0); in PyConfig_Read()
2557 assert(config->use_hash_seed >= 0); in PyConfig_Read()
2558 assert(config->faulthandler >= 0); in PyConfig_Read()
2559 assert(config->tracemalloc >= 0); in PyConfig_Read()
2560 assert(config->site_import >= 0); in PyConfig_Read()
2561 assert(config->bytes_warning >= 0); in PyConfig_Read()
2562 assert(config->inspect >= 0); in PyConfig_Read()
2563 assert(config->interactive >= 0); in PyConfig_Read()
2564 assert(config->optimization_level >= 0); in PyConfig_Read()
2565 assert(config->parser_debug >= 0); in PyConfig_Read()
2566 assert(config->write_bytecode >= 0); in PyConfig_Read()
2567 assert(config->verbose >= 0); in PyConfig_Read()
2568 assert(config->quiet >= 0); in PyConfig_Read()
2569 assert(config->user_site_directory >= 0); in PyConfig_Read()
2570 assert(config->parse_argv >= 0); in PyConfig_Read()
2571 assert(config->configure_c_stdio >= 0); in PyConfig_Read()
2572 assert(config->buffered_stdio >= 0); in PyConfig_Read()
2573 assert(config->program_name != NULL); in PyConfig_Read()
2574 assert(_PyWideStringList_CheckConsistency(&config->argv)); in PyConfig_Read()
2576 assert(config->argv.length >= 1); in PyConfig_Read()
2577 assert(_PyWideStringList_CheckConsistency(&config->xoptions)); in PyConfig_Read()
2578 assert(_PyWideStringList_CheckConsistency(&config->warnoptions)); in PyConfig_Read()
2579 assert(_PyWideStringList_CheckConsistency(&config->module_search_paths)); in PyConfig_Read()
2580 if (config->_install_importlib) { in PyConfig_Read()
2581 assert(config->module_search_paths_set != 0); in PyConfig_Read()
2583 assert(config->executable != NULL); in PyConfig_Read()
2584 assert(config->base_executable != NULL); in PyConfig_Read()
2585 assert(config->prefix != NULL); in PyConfig_Read()
2586 assert(config->base_prefix != NULL); in PyConfig_Read()
2587 assert(config->exec_prefix != NULL); in PyConfig_Read()
2588 assert(config->base_exec_prefix != NULL); in PyConfig_Read()
2590 assert(config->platlibdir != NULL); in PyConfig_Read()
2591 assert(config->filesystem_encoding != NULL); in PyConfig_Read()
2592 assert(config->filesystem_errors != NULL); in PyConfig_Read()
2593 assert(config->stdio_encoding != NULL); in PyConfig_Read()
2594 assert(config->stdio_errors != NULL); in PyConfig_Read()
2596 assert(config->legacy_windows_stdio >= 0); in PyConfig_Read()
2599 assert(!(config->run_command != NULL && config->run_module != NULL)); in PyConfig_Read()
2600 assert(config->check_hash_pycs_mode != NULL); in PyConfig_Read()
2601 assert(config->_install_importlib >= 0); in PyConfig_Read()
2602 assert(config->pathconfig_warnings >= 0); in PyConfig_Read()
2603 assert(_PyWideStringList_CheckConsistency(&config->_orig_argv)); in PyConfig_Read()
2647 const PyConfig *config = _PyInterpreterState_GetConfig(tstate->interp); in _Py_GetConfigsAsDict() local
2648 dict = config_as_dict(config); in _Py_GetConfigsAsDict()
2710 init_dump_ascii_wstr(config->FIELD); \ in _Py_DumpPathConfig()
2714 const PyConfig *config = _PyInterpreterState_GetConfig(tstate->interp); in _Py_DumpPathConfig() local
2718 PySys_WriteStderr(" isolated = %i\n", config->isolated); in _Py_DumpPathConfig()
2719 PySys_WriteStderr(" environment = %i\n", config->use_environment); in _Py_DumpPathConfig()
2720 PySys_WriteStderr(" user site = %i\n", config->user_site_directory); in _Py_DumpPathConfig()
2721 PySys_WriteStderr(" import site = %i\n", config->site_import); in _Py_DumpPathConfig()