https://github.com/python/cpython/commit/81518cec90434a650bcddfa9ec928f5124c2ed2e commit: 81518cec90434a650bcddfa9ec928f5124c2ed2e branch: main author: Rafid Aslam <[email protected]> committer: ambv <[email protected]> date: 2026-10-21T00:57:56-07:00 summary:
gh-125873: Improve error message when PYTHONHOME is invalid (#126027) Co-authored-by: Lukasz Langa <[email protected]> files: A Misc/NEWS.d/next/Core_and_Builtins/2024-10-27-22-23-57.gh-issue-125873.BG97KU.rst M Python/codecs.c diff --git a/Misc/NEWS.d/next/Core_and_Builtins/2024-10-27-22-23-57.gh-issue-125873.BG97KU.rst b/Misc/NEWS.d/next/Core_and_Builtins/2024-10-27-22-23-57.gh-issue-125873.BG97KU.rst new file mode 100644 index 00000000000000..fc4818781ee132 --- /dev/null +++ b/Misc/NEWS.d/next/Core_and_Builtins/2024-10-27-22-23-57.gh-issue-125873.BG97KU.rst @@ -0,0 +1 @@ +Improved error message when an environment variable is misconfigured. diff --git a/Python/codecs.c b/Python/codecs.c index 8a4d99bdd924fa..c9802af937296e 100644 --- a/Python/codecs.c +++ b/Python/codecs.c @@ -1693,7 +1693,9 @@ _PyCodec_InitRegistry(PyInterpreterState *interp) if (mod == NULL) { PyThreadState *tstate = _PyThreadState_GET(); _Py_DumpPathConfig(tstate); - return PyStatus_Error("Failed to import encodings module"); + return PyStatus_Error("Failed to import encodings module. " + "Your environment probably has misconfigured variables! " + "Please check PYTHONHOME otherwise refer to `--help-env`"); } Py_DECREF(mod); _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
