Mercurial > cpython-lru_cache-weakref
diff Python/sysmodule.c @ 27977:0fe321e78ad3 legacy-trunk
- sys.path[0] (the directory from which the script is loaded) is now
turned into an absolute pathname, unless it is the empty string.
(SF patch #664376, by Skip Montanaro.)
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Wed, 19 Feb 2003 15:25:10 +0000 |
| parents | 16856c9514e0 |
| children | 869695cba2cd |
line wrap: on
line diff
--- a/Python/sysmodule.c Wed Feb 19 14:27:21 2003 +0000 +++ b/Python/sysmodule.c Wed Feb 19 15:25:10 2003 +0000 @@ -993,7 +993,9 @@ void PySys_SetArgv(int argc, char **argv) { -#ifdef MS_WINDOWS +#if defined(HAVE_REALPATH) + char fullpath[MAXPATHLEN]; +#elif defined(MS_WINDOWS) char fullpath[MAX_PATH]; #endif PyObject *av = makeargvobject(argc, argv); @@ -1059,8 +1061,14 @@ } } #else /* All other filename syntaxes */ - if (argc > 0 && argv0 != NULL) + if (argc > 0 && argv0 != NULL) { +#if defined(HAVE_REALPATH) + if (realpath(argv0, fullpath)) { + argv0 = fullpath; + } +#endif p = strrchr(argv0, SEP); + } if (p != NULL) { #ifndef RISCOS n = p + 1 - argv0;
