cpython: 238cbd559e9c (original) (raw)
Mercurial > cpython
changeset 68737:238cbd559e9c
Fix imp.cache_from_source() if the directory name contains a dot If the directory name contains a dot but not the filename, don't strip at the dot.
Victor Stinner victor.stinner@haypocalc.com | |
---|---|
date | Mon, 14 Mar 2011 15:05:12 -0400 |
parents | c17bc2026145 |
children | c4361bab6914 |
files | Lib/test/test_imp.py Python/import.c |
diffstat | 2 files changed, 6 insertions(+), 2 deletions(-)[+] [-] Lib/test/test_imp.py 4 Python/import.c 4 |
line wrap: on
line diff
--- a/Lib/test/test_imp.py +++ b/Lib/test/test_imp.py @@ -210,6 +210,10 @@ class PEP3147Tests(unittest.TestCase): self.assertEqual( imp.cache_from_source('/foo/bar/baz/qux.py', True), '/foo/bar/baz/pycache/qux.{}.pyc'.format(self.tag))
# Directory with a dot, filename without dot[](#l1.7)
self.assertEqual([](#l1.8)
imp.cache_from_source('/foo.bar/file', True),[](#l1.9)
'/foo.bar/__pycache__/file{}.pyc'.format(self.tag))[](#l1.10)
def test_cache_from_source_optimized(self): # Given the path to a .py file, return the path to its PEP 3147
--- a/Python/import.c +++ b/Python/import.c @@ -943,12 +943,12 @@ make_compiled_pathname(Py_UNICODE *pathn Py_UNICODE_strcat(buf, CACHEDIR_UNICODE); i += Py_UNICODE_strlen(CACHEDIR_UNICODE) - 1; buf[i++] = sep;