diff Modules/getpath.c @ 65169:77a6a249e24e

copy_absolute() keeps the relative path on _Py_wgetcwd() failure .. instead of raising a fatal error. Even if the current directory was deleted, use relative paths may still work (eg. run Python with "../python").
author Victor Stinner <victor.stinner@haypocalc.com>
date Thu, 07 Oct 2010 23:29:18 +0000
parents e4bdd07ce0c6
children a27fc0ff3678
line wrap: on
line diff
--- a/Modules/getpath.c	Thu Oct 07 22:53:43 2010 +0000
+++ b/Modules/getpath.c	Thu Oct 07 23:29:18 2010 +0000
@@ -236,8 +236,11 @@
     if (p[0] == SEP)
         wcscpy(path, p);
     else {
-        if (!_Py_wgetcwd(path, MAXPATHLEN))
-            Py_FatalError("unable to get the current directory");
+        if (!_Py_wgetcwd(path, MAXPATHLEN)) {
+            /* unable to get the current directory */
+            wcscpy(path, p);
+            return;
+        }
         if (p[0] == '.' && p[1] == SEP)
             p += 2;
         joinpath(path, p);