[Python-Dev] [Python-checkins] cpython (3.4): - Issue #22966: Fix pycache pyc file name clobber when pyc_compile is (original) (raw)
Jeremy Kloth jeremy.kloth at gmail.com
Tue Dec 2 14:44:01 CET 2014
- Previous message: [Python-Dev] LTTng-UST support for CPython
- Next message: [Python-Dev] [Python-checkins] cpython (3.4): - Issue #22966: Fix __pycache__ pyc file name clobber when pyc_compile is
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Dec 1, 2014 at 4:17 PM, barry.warsaw <python-checkins at python.org> wrote:
summary: - Issue #22966: Fix pycache pyc file name clobber when pyccompile is asked to compile a source file containing multiple dots in the source file name.
diff --git a/Lib/test/testpycompile.py b/Lib/test/testpycompile.py --- a/Lib/test/testpycompile.py +++ b/Lib/test/testpycompile.py @@ -99,5 +99,21 @@ self.assertFalse(os.path.exists( importlib.util.cachefromsource(badcoding))) + def testdoubledotnoclobber(self): + # http://bugs.python.org/issue22966 + # pycompile foo.bar.py -> pycache/foo.cpython-34.pyc + weirdpath = os.path.join(self.directory, 'foo.bar.py') + cachepath = importlib.util.cachefromsource(weirdpath) + pycpath = weirdpath + 'c' + self.assertEqual( + '/'.join(cachepath.split('/')[-2:]), + 'pycache/foo.bar.cpython-34.pyc') + with open(weirdpath, 'w') as file: + file.write('x = 123\n') + pycompile.compile(weirdpath) + self.assertTrue(os.path.exists(cachepath)) + self.assertFalse(os.path.exists(pycpath)) + +
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
- Previous message: [Python-Dev] LTTng-UST support for CPython
- Next message: [Python-Dev] [Python-checkins] cpython (3.4): - Issue #22966: Fix __pycache__ pyc file name clobber when pyc_compile is
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]