[Python-checkins] r85311 - python/branches/py3k/Modules/getpath.c

victor.stinner python-checkins at python.org
Fri Oct 8 01:29:23 CEST 2010


Author: victor.stinner
Date: Fri Oct  8 01:29:18 2010
New Revision: 85311

Log:
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").


Modified:
   python/branches/py3k/Modules/getpath.c

Modified: python/branches/py3k/Modules/getpath.c
==============================================================================
--- python/branches/py3k/Modules/getpath.c	(original)
+++ python/branches/py3k/Modules/getpath.c	Fri Oct  8 01:29:18 2010
@@ -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);


More information about the Python-checkins mailing list