Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1422e9d

Browse files
committed
SF patch 493739 2 Bugfixes for 2.2c1 (RISC OS specific), from
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.] """
1 parent c577728 commit 1422e9d

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

Lib/plat-riscos/riscospath.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,8 @@ def expandvars(p):
311311
return b.tostring(0, swi.swi('OS_GSTrans', 'sbi;..i', p, b, l))
312312

313313

314-
# Return an absolute path.
315-
316-
def abspath(p):
317-
return normpath(join(os.getcwd(), p))
314+
# Return an absolute path. RISC OS' osfscontrol_canonicalise_path does this among others
315+
abspath = os.expand
318316

319317

320318
# realpath is a no-op on systems without islink support

RISCOS/Modules/getpath_riscos.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ calculate_path()
1111
int pathlen = strlen(pypath);
1212
module_search_path = malloc(pathlen + 1);
1313
if (module_search_path)
14-
strncpy(module_search_path, pypath, pathlen);
14+
strncpy(module_search_path, pypath, pathlen + 1);
1515
else {
1616
fprintf(stderr,
1717
"Not enough memory for dynamic PYTHONPATH.\n"

0 commit comments

Comments
 (0)