On Mon, Dec 1, 2014 at 4:17 PM, barry.warsaw <python-check...@python.org> wrote: > summary: > - Issue #22966: Fix __pycache__ pyc file name clobber when pyc_compile is > asked to compile a source file containing multiple dots in the source file > name. > > diff --git a/Lib/test/test_py_compile.py b/Lib/test/test_py_compile.py > --- a/Lib/test/test_py_compile.py > +++ b/Lib/test/test_py_compile.py > @@ -99,5 +99,21 @@ > self.assertFalse(os.path.exists( > importlib.util.cache_from_source(bad_coding))) > > + def test_double_dot_no_clobber(self): > + # http://bugs.python.org/issue22966 > + # py_compile foo.bar.py -> __pycache__/foo.cpython-34.pyc > + weird_path = os.path.join(self.directory, 'foo.bar.py') > + cache_path = importlib.util.cache_from_source(weird_path) > + pyc_path = weird_path + 'c' > + self.assertEqual( > + '/'.join(cache_path.split('/')[-2:]), > + '__pycache__/foo.bar.cpython-34.pyc') > + with open(weird_path, 'w') as file: > + file.write('x = 123\n') > + py_compile.compile(weird_path) > + self.assertTrue(os.path.exists(cache_path)) > + self.assertFalse(os.path.exists(pyc_path)) > + > +
This test is failing on the Windows buildbots due to the hard-coded path separator. Using `os.pathsep` should work assuming that importlib returns normalized paths. -- Jeremy Kloth _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com