diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-11 12:06:38 +0200 |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-11-11 12:06:38 +0200 |
commit | a27c064428c9e3b601be69876ef7e7299a3e0b7f (patch) | |
tree | 9b81e5bf040ba465e4e2c91f3776335ce1c56325 | |
parent | 839102603cf81496b5b5c663fff6c06106db2a15 (diff) | |
parent | 62e32d6352e318ed03eb519aedbc975b772114b5 (diff) | |
download | cpython-git-a27c064428c9e3b601be69876ef7e7299a3e0b7f.tar.gz |
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.
-rw-r--r-- | Lib/test/test_trace.py | 8 | ||||
-rw-r--r-- | Misc/NEWS | 3 | ||||
-rw-r--r-- | Modules/getpath.c | 5 |
3 files changed, 11 insertions, 5 deletions
diff --git a/Lib/test/test_trace.py b/Lib/test/test_trace.py index 1d894aaf84..1d87aea5a3 100644 --- a/Lib/test/test_trace.py +++ b/Lib/test/test_trace.py @@ -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 @@ -10,6 +10,9 @@ What's New in Python 3.6.0 beta 4 Core and Builtins ----------------- +- Issue #19398: Extra slash no longer added to sys.path components in case of + empty compile-time PYTHONPATH components. + - Issue #28583: PyDict_SetDefault didn't combine split table when needed. Patch by Xiang Zhang. diff --git a/Modules/getpath.c b/Modules/getpath.c index 65b47a3676..0f916436c5 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) { |