summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2016-11-11 10:05:01 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2016-11-11 10:05:01 (GMT)
commit62e32d6352e318ed03eb519aedbc975b772114b5 (patch)
treefc1c9a969d8f3cb0ef30a5d6275fe5ba9a205882 /Modules
parentdaeddc48a469b38c2817ecd1b70ef0fba6fb6ce9 (diff)
downloadcpython-62e32d6352e318ed03eb519aedbc975b772114b5.zip
cpython-62e32d6352e318ed03eb519aedbc975b772114b5.tar.gz
cpython-62e32d6352e318ed03eb519aedbc975b772114b5.tar.bz2
Issue #19398: Extra slash no longer added to sys.path components in case of
empty compile-time PYTHONPATH components. This fixes some tests in -S or -I modes.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/getpath.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/getpath.c b/Modules/getpath.c
index 18deb60..c438b8e 100644
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -762,7 +762,10 @@ calculate_path(void)
if (defpath[0] != SEP) {
wcscat(buf, prefix);
- wcscat(buf, separator);
+ if (prefixsz >= 2 && prefix[prefixsz - 2] != SEP &&
+ defpath[0] != (delim ? DELIM : L'\0')) { /* not empty */
+ wcscat(buf, separator);
+ }
}
if (delim) {