mirror of
https://github.com/python/cpython.git
synced 2025-12-04 08:34:25 +00:00
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.
This commit is contained in:
parent
daeddc48a4
commit
62e32d6352
3 changed files with 11 additions and 5 deletions
|
|
@ -311,11 +311,11 @@ class TestCoverage(unittest.TestCase):
|
||||||
with captured_stdout() as stdout:
|
with captured_stdout() as stdout:
|
||||||
self._coverage(tracer)
|
self._coverage(tracer)
|
||||||
stdout = stdout.getvalue()
|
stdout = stdout.getvalue()
|
||||||
self.assertTrue("pprint.py" in stdout)
|
self.assertIn("pprint.py", stdout)
|
||||||
self.assertTrue("case.py" in stdout) # from unittest
|
self.assertIn("case.py", stdout) # from unittest
|
||||||
files = os.listdir(TESTFN)
|
files = os.listdir(TESTFN)
|
||||||
self.assertTrue("pprint.cover" in files)
|
self.assertIn("pprint.cover", files)
|
||||||
self.assertTrue("unittest.case.cover" in files)
|
self.assertIn("unittest.case.cover", files)
|
||||||
|
|
||||||
def test_coverage_ignore(self):
|
def test_coverage_ignore(self):
|
||||||
# Ignore all files, nothing should be traced nor printed
|
# Ignore all files, nothing should be traced nor printed
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,9 @@ Release date: TBA
|
||||||
Core and Builtins
|
Core and Builtins
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
|
- Issue #19398: Extra slash no longer added to sys.path components in case of
|
||||||
|
empty compile-time PYTHONPATH components.
|
||||||
|
|
||||||
- Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug
|
- Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug
|
||||||
build.
|
build.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -762,8 +762,11 @@ calculate_path(void)
|
||||||
|
|
||||||
if (defpath[0] != SEP) {
|
if (defpath[0] != SEP) {
|
||||||
wcscat(buf, prefix);
|
wcscat(buf, prefix);
|
||||||
|
if (prefixsz >= 2 && prefix[prefixsz - 2] != SEP &&
|
||||||
|
defpath[0] != (delim ? DELIM : L'\0')) { /* not empty */
|
||||||
wcscat(buf, separator);
|
wcscat(buf, separator);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (delim) {
|
if (delim) {
|
||||||
size_t len = delim - defpath + 1;
|
size_t len = delim - defpath + 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue