Skip to content

Commit 1fc1198

Browse files
Default to "-X frozen_modules=off" if built with --with-debug.
1 parent 358ab69 commit 1fc1198

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Freeze all the modules that are imported during Python startup. This gives
22
us meaningful performance improvements to startup. Also add a new command
33
line option, "-X frozen_modules=[on|off]" to opt out of (or into) using
4-
frozen modules. This defaults to "on".
4+
frozen modules. This defaults to "on" (or "off" if it's a debug build).

Python/initconfig.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2123,9 +2123,15 @@ _PyConfig_InitImportConfig(PyConfig *config)
21232123
/* -X frozen_modules=[on|off] */
21242124
const wchar_t *value = config_get_xoption_value(config, L"frozen_modules");
21252125
if (value == NULL) {
2126-
// Use a meaningful default.
2127-
// XXX Add the logic.
2126+
// Use a meaningful default:
2127+
// * "off" for core development (running in a local repo)
2128+
// * "on" otherwise (e.g. for release builds)
2129+
#ifdef Py_DEBUG
2130+
// For now, Py_DEBUG is an adequate approximation of core development.
21282131
config->use_frozen_modules = false;
2132+
#else
2133+
config->use_frozen_modules = true;
2134+
#endif
21292135
}
21302136
else if (wcscmp(value, L"on") == 0) {
21312137
config->use_frozen_modules = true;

0 commit comments

Comments
 (0)