summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-10-07 23:29:18 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-10-07 23:29:18 (GMT)
commit4f3abb0f091b14e09d257ee4eb40632471177d6d (patch)
tree9149282dcf1713e0e472c11530faa8be4c2b528e
parent6672d0c5bbbb15671d3fa46a2cd0c99d7344f41f (diff)
downloadcpython-4f3abb0f091b14e09d257ee4eb40632471177d6d.zip
cpython-4f3abb0f091b14e09d257ee4eb40632471177d6d.tar.gz
cpython-4f3abb0f091b14e09d257ee4eb40632471177d6d.tar.bz2
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").
-rw-r--r--Modules/getpath.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Modules/getpath.c b/Modules/getpath.c
index ee784dd..9e5934d 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -236,8 +236,11 @@ copy_absolute(wchar_t *path, wchar_t *p)
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);