- 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.)
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 765621e..1f51f98 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -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;