diff -r 5b253d641826 Lib/test/test_trace.py --- a/Lib/test/test_trace.py Wed Nov 09 18:56:26 2016 -0500 +++ b/Lib/test/test_trace.py Thu Nov 10 12:12:50 2016 +0200 @@ -311,11 +311,11 @@ class TestCoverage(unittest.TestCase): with captured_stdout() as stdout: self._coverage(tracer) stdout = stdout.getvalue() - self.assertTrue("pprint.py" in stdout) - self.assertTrue("case.py" in stdout) # from unittest + self.assertIn("pprint.py", stdout) + self.assertIn("case.py", stdout) # from unittest files = os.listdir(TESTFN) - self.assertTrue("pprint.cover" in files) - self.assertTrue("unittest.case.cover" in files) + self.assertIn("pprint.cover", files) + self.assertIn("unittest.case.cover", files) def test_coverage_ignore(self): # Ignore all files, nothing should be traced nor printed diff -r 5b253d641826 Modules/getpath.c --- a/Modules/getpath.c Wed Nov 09 18:56:26 2016 -0500 +++ b/Modules/getpath.c Thu Nov 10 12:12:50 2016 +0200 @@ -719,9 +719,14 @@ calculate_path(void) while (1) { wchar_t *delim = wcschr(defpath, DELIM); - if (defpath[0] != SEP) + if (defpath[0] != SEP) { /* Paths are relative to prefix */ bufsz += prefixsz; + if (prefixsz >= 2 && prefix[prefixsz - 2] != SEP && + defpath[0] != (delim ? DELIM : L'\0')) { /* not empty */ + bufsz++; + } + } if (delim) bufsz += delim - defpath + 1; @@ -762,7 +767,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) {