summaryrefslogtreecommitdiffstats
path: root/Python/initconfig.c
diff options
context:
space:
mode:
authorKumar Aditya <59607654+kumaraditya303@users.noreply.github.com>2022-05-03 22:20:13 (GMT)
committerGitHub <noreply@github.com>2022-05-03 22:20:13 (GMT)
commite8d7661ff25fb698062ab07e37362c2c20471984 (patch)
tree5d6a88c5568393ad2dcceeb1a3e5884612315d27 /Python/initconfig.c
parent48c6165c28dfb40eafd2fa6de9bebd14fbc7c95c (diff)
downloadcpython-e8d7661ff25fb698062ab07e37362c2c20471984.zip
cpython-e8d7661ff25fb698062ab07e37362c2c20471984.tar.gz
cpython-e8d7661ff25fb698062ab07e37362c2c20471984.tar.bz2
GH-91173: disable frozen modules in debug builds (#92023)
Diffstat (limited to 'Python/initconfig.c')
-rw-r--r--Python/initconfig.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/Python/initconfig.c b/Python/initconfig.c
index 729f7f3..d928ebe 100644
--- a/Python/initconfig.c
+++ b/Python/initconfig.c
@@ -732,7 +732,11 @@ _PyConfig_InitCompatConfig(PyConfig *config)
#ifdef MS_WINDOWS
config->legacy_windows_stdio = -1;
#endif
- config->use_frozen_modules = -1;
+#ifdef Py_DEBUG
+ config->use_frozen_modules = 0;
+#else
+ config->use_frozen_modules = 1;
+#endif
config->_is_python_build = 0;
config->code_debug_ranges = 1;
}
@@ -1978,25 +1982,22 @@ config_init_import(PyConfig *config, int compute_path_config)
}
/* -X frozen_modules=[on|off] */
- if (config->use_frozen_modules < 0) {
- const wchar_t *value = config_get_xoption_value(config, L"frozen_modules");
- if (value == NULL) {
- config->use_frozen_modules = !config->_is_python_build;
- }
- else if (wcscmp(value, L"on") == 0) {
- config->use_frozen_modules = 1;
- }
- else if (wcscmp(value, L"off") == 0) {
- config->use_frozen_modules = 0;
- }
- else if (wcslen(value) == 0) {
- // "-X frozen_modules" and "-X frozen_modules=" both imply "on".
- config->use_frozen_modules = 1;
- }
- else {
- return PyStatus_Error("bad value for option -X frozen_modules "
- "(expected \"on\" or \"off\")");
- }
+ const wchar_t *value = config_get_xoption_value(config, L"frozen_modules");
+ if (value == NULL) {
+ }
+ else if (wcscmp(value, L"on") == 0) {
+ config->use_frozen_modules = 1;
+ }
+ else if (wcscmp(value, L"off") == 0) {
+ config->use_frozen_modules = 0;
+ }
+ else if (wcslen(value) == 0) {
+ // "-X frozen_modules" and "-X frozen_modules=" both imply "on".
+ config->use_frozen_modules = 1;
+ }
+ else {
+ return PyStatus_Error("bad value for option -X frozen_modules "
+ "(expected \"on\" or \"off\")");
}
return _PyStatus_OK();