summaryrefslogtreecommitdiffstats
path: root/Programs/_freeze_importlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'Programs/_freeze_importlib.c')
-rw-r--r--Programs/_freeze_importlib.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/Programs/_freeze_importlib.c b/Programs/_freeze_importlib.c
index fdf5013..2621a76 100644
--- a/Programs/_freeze_importlib.c
+++ b/Programs/_freeze_importlib.c
@@ -81,8 +81,15 @@ main(int argc, char *argv[])
config.program_name = L"./_freeze_importlib";
/* Don't install importlib, since it could execute outdated bytecode. */
config._install_importlib = 0;
- config.install_signal_handlers = 1;
config._frozen = 1;
+#ifdef MS_WINDOWS
+ /* bpo-34523: initfsencoding() is not called if _install_importlib=0,
+ so interp->fscodec_initialized value remains 0.
+ PyUnicode_EncodeFSDefault() doesn't support the "surrogatepass" error
+ handler in such case, whereas it's the default error handler on Windows.
+ Force the "strict" error handler to work around this bootstrap issue. */
+ config.filesystem_errors = "strict";
+#endif
_PyInitError err = _Py_InitializeFromConfig(&config);
/* No need to call _PyCoreConfig_Clear() since we didn't allocate any