bpo-36236: Handle removed cwd at Python init (GH-12450)
At Python initialization, the current directory is no longer
prepended to sys.path if it has been removed.
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index cdc2edf..c01a04e 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -2615,7 +2615,10 @@
if (updatepath) {
/* If argv[0] is not '-c' nor '-m', prepend argv[0] to sys.path.
If argv[0] is a symlink, use the real path. */
- PyObject *argv0 = _PyPathConfig_ComputeArgv0(argc, argv);
+ PyObject *argv0 = NULL;
+ if (!_PyPathConfig_ComputeArgv0(argc, argv, &argv0)) {
+ return;
+ }
if (argv0 == NULL) {
Py_FatalError("can't compute path0 from argv");
}