]> granicus.if.org Git - python/commitdiff
#11132: pass optimize parameter to recursive call in compileall.compile_dir(). Revie...
authorGeorg Brandl <georg@python.org>
Mon, 7 Feb 2011 12:36:54 +0000 (12:36 +0000)
committerGeorg Brandl <georg@python.org>
Mon, 7 Feb 2011 12:36:54 +0000 (12:36 +0000)
Lib/compileall.py
Lib/test/test_compileall.py
Misc/ACKS
Misc/NEWS

index 1030d8c8f0806e83ea5f35a08f68af1c847f9fe5..d79a1bb9a092c40892eb7a97fa62ebe36abff527 100644 (file)
@@ -58,7 +58,7 @@ def compile_dir(dir, maxlevels=10, ddir=None, force=False, rx=None,
         elif (maxlevels > 0 and name != os.curdir and name != os.pardir and
               os.path.isdir(fullname) and not os.path.islink(fullname)):
             if not compile_dir(fullname, maxlevels - 1, dfile, force, rx,
-                               quiet, legacy):
+                               quiet, legacy, optimize):
                 success = 0
     return success
 
index 295dc400671e1ad54423ddf08d3c06ab49b27777..250d31b42e411ede28f9c47125099db625a09790 100644 (file)
@@ -24,6 +24,10 @@ class CompileallTests(unittest.TestCase):
         self.source_path2 = os.path.join(self.directory, '_test2.py')
         self.bc_path2 = imp.cache_from_source(self.source_path2)
         shutil.copyfile(self.source_path, self.source_path2)
+        self.subdirectory = os.path.join(self.directory, '_subdir')
+        os.mkdir(self.subdirectory)
+        self.source_path3 = os.path.join(self.subdirectory, '_test3.py')
+        shutil.copyfile(self.source_path, self.source_path3)
 
     def tearDown(self):
         shutil.rmtree(self.directory)
@@ -96,6 +100,12 @@ class CompileallTests(unittest.TestCase):
         cached = imp.cache_from_source(self.source_path,
                                        debug_override=not optimize)
         self.assertTrue(os.path.isfile(cached))
+        cached2 = imp.cache_from_source(self.source_path2,
+                                       debug_override=not optimize)
+        self.assertTrue(os.path.isfile(cached2))
+        cached3 = imp.cache_from_source(self.source_path3,
+                                       debug_override=not optimize)
+        self.assertTrue(os.path.isfile(cached3))
 
 
 class EncodingTest(unittest.TestCase):
index 8e1200765409b1d2d22f1d77643623e966d93640..c22e360fa6ac482497178c4beb0e2f3b1ae2448d 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -843,6 +843,7 @@ James Thomas
 Robin Thomas
 Jeremy Thurgood
 Eric Tiedemann
+July Tikhonov
 Tracy Tims
 Oren Tirosh
 Jason Tishler
index 7dbbcbb748fee051d81748168a96c0764269164a..80c08c2924ed54f88c52496a7110ff94a6f1ba6a 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -18,6 +18,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #11132: Fix passing of "optimize" parameter when recursing
+  in compileall.compile_dir().
+
 - Issue #11110: Fix a potential decref of a NULL in sqlite3.
 
 - Issue #8275: Fix passing of callback arguments with ctypes under Win64.