changeset: 105054:82607e7c24c7 parent: 105051:5d1067e89717 parent: 105053:1a88baaed7a0 user: Serhiy Storchaka date: Fri Nov 11 12:07:48 2016 +0200 files: Misc/NEWS description: 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. diff -r 5d1067e89717 -r 82607e7c24c7 Lib/test/test_trace.py --- a/Lib/test/test_trace.py Fri Nov 11 11:48:22 2016 +0200 +++ b/Lib/test/test_trace.py Fri Nov 11 12:07:48 2016 +0200 @@ -311,11 +311,11 @@ 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 5d1067e89717 -r 82607e7c24c7 Misc/NEWS --- a/Misc/NEWS Fri Nov 11 11:48:22 2016 +0200 +++ b/Misc/NEWS Fri Nov 11 12:07:48 2016 +0200 @@ -10,6 +10,9 @@ Core and Builtins ----------------- +- Issue #19398: Extra slash no longer added to sys.path components in case of + empty compile-time PYTHONPATH components. + - Issue #28621: Sped up converting int to float by reusing faster bits counting implementation. Patch by Adrian Wielgosik. diff -r 5d1067e89717 -r 82607e7c24c7 Modules/getpath.c --- a/Modules/getpath.c Fri Nov 11 11:48:22 2016 +0200 +++ b/Modules/getpath.c Fri Nov 11 12:07:48 2016 +0200 @@ -762,7 +762,10 @@ 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) {