]> granicus.if.org Git - python/commitdiff
SF patch 493739 2 Bugfixes for 2.2c1 (RISC OS specific), from
authorTim Peters <tim.peters@gmail.com>
Sat, 15 Dec 2001 22:12:47 +0000 (22:12 +0000)
committerTim Peters <tim.peters@gmail.com>
Sat, 15 Dec 2001 22:12:47 +0000 (22:12 +0000)
Dietmar Schwertberger.
Bugfix candidate.
"""
RISCOS/Modules/getpath_riscos.c:
Include trailing '\0' when using strncpy [copy
strlen(...)+1 characters].

Lib/plat-riscos/riscospath.py:
Use riscosmodule.expand for os.path.abspath.
[fixes problems with site.py where
abspath("<Python$Dir>") returned
join(os.getcwd(), "<Python$Dir>") as e.g.
"SCSI::SCSI4.$.<Python$Dir>" because "<Python$Dir>"
wasn't recognised as an absolute path.]
"""

Lib/plat-riscos/riscospath.py
RISCOS/Modules/getpath_riscos.c

index fb0e477e76b9a133509d40770aa65bc7a64018f6..30c0c9fe5160881be54c9eadc9dedb3564a70481 100644 (file)
@@ -311,10 +311,8 @@ def expandvars(p):
     return b.tostring(0, swi.swi('OS_GSTrans', 'sbi;..i', p, b, l))
 
 
-# Return an absolute path.
-
-def abspath(p):
-    return normpath(join(os.getcwd(), p))
+# Return an absolute path. RISC OS' osfscontrol_canonicalise_path does this among others
+abspath = os.expand
 
 
 # realpath is a no-op on systems without islink support
index 5ac8b727e2d5e550ad57a429b384cc0d02fc52fa..ce978c6c462a6e30e2293cd9a3f57804efb98947 100644 (file)
@@ -11,7 +11,7 @@ calculate_path()
                int pathlen = strlen(pypath);
                module_search_path = malloc(pathlen + 1);
                if (module_search_path) 
-                       strncpy(module_search_path, pypath, pathlen);
+                       strncpy(module_search_path, pypath, pathlen + 1);
                else {
                        fprintf(stderr, 
                                "Not enough memory for dynamic PYTHONPATH.\n"