◐ Shell
reader mode source ↗
Skip to content
Merged
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
9 changes: 8 additions & 1 deletion Include/pystate.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ typedef struct {

See PEP 552 "Deterministic pycs" for more details. */
const char *_check_hash_pycs_mode;
} _PyCoreConfig;

#ifdef MS_WINDOWS
Expand Down Expand Up @@ -269,7 +275,8 @@ typedef struct {
.user_site_directory = -1, \
.unbuffered_stdio = -1, \
_PyCoreConfig_WINDOWS_INIT \
._install_importlib = 1}
/* Note: _PyCoreConfig_INIT sets other fields to 0/NULL */

/* Placeholders while working on the new configuration API
Expand Down
5 changes: 5 additions & 0 deletions Modules/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ _PyCoreConfig_GetGlobalConfig(_PyCoreConfig *config)
COPY_FLAG(legacy_windows_fs_encoding, Py_LegacyWindowsFSEncodingFlag);
COPY_FLAG(legacy_windows_stdio, Py_LegacyWindowsStdioFlag);
#endif

COPY_NOT_FLAG(use_environment, Py_IgnoreEnvironmentFlag);
COPY_NOT_FLAG(site_import, Py_NoSiteFlag);
Expand Down Expand Up @@ -759,6 +760,7 @@ _PyCoreConfig_Copy(_PyCoreConfig *config, const _PyCoreConfig *config2)
COPY_ATTR(legacy_windows_stdio);
#endif
COPY_ATTR(_check_hash_pycs_mode);

#undef COPY_ATTR
#undef COPY_STR_ATTR
Expand Down Expand Up @@ -2281,6 +2283,9 @@ _PyCoreConfig_Read(_PyCoreConfig *config)
if (config->utf8_mode < 0) {
config->utf8_mode = 0;
}

return _Py_INIT_OK();
}
Expand Down
3 changes: 1 addition & 2 deletions Programs/_freeze_importlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ main(int argc, char *argv[])
/* Don't install importlib, since it could execute outdated bytecode. */
config._install_importlib = 0;
config.install_signal_handlers = 1;

Py_FrozenFlag++;

_PyInitError err = _Py_InitializeFromConfig(&config);
/* No need to call _PyCoreConfig_Clear() since we didn't allocate any
Expand Down
12 changes: 10 additions & 2 deletions Python/frozenmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ Py_FrozenMain(int argc, char **argv)
}
}

Py_FrozenFlag = 1; /* Suppress errors from getpath.c */

if ((p = Py_GETENV("PYTHONINSPECT")) && *p != '\0')
inspect = 1;
Expand Down Expand Up @@ -80,7 +81,14 @@ Py_FrozenMain(int argc, char **argv)
#endif /* MS_WINDOWS */
if (argc >= 1)
Py_SetProgramName(argv_copy[0]);
Py_Initialize();
#ifdef MS_WINDOWS
PyWinFreeze_ExeInit();
#endif
Expand Down
Toggle all file notes Toggle all file annotations