[commit: ghc] master: Fix test driver python3 compatibility issues (c6d4ae6)

git at git.haskell.org git at git.haskell.org
Thu Oct 30 16:54:19 UTC 2014


Repository : ssh://git@git.haskell.org/ghc

On branch  : master
Link       : http://ghc.haskell.org/trac/ghc/changeset/c6d4ae6f437fb041ea70f3d2b4f7f0d03ff797bf/ghc

>---------------------------------------------------------------

commit c6d4ae6f437fb041ea70f3d2b4f7f0d03ff797bf
Author: Mateusz Lenik <mlen at mlen.pl>
Date:   Thu Oct 30 11:50:41 2014 -0500

    Fix test driver python3 compatibility issues
    
    Summary:
    Fixes python3 compatibility issues by replacing filter with a list
    comperhension and a potential issue with python2 when override_flags
    would be an empty list.
    
    Reviewers: austin, thomie
    
    Reviewed By: austin, thomie
    
    Subscribers: thomie, carter, simonmar, mlen
    
    Differential Revision: https://phabricator.haskell.org/D399
    
    GHC Trac Issues: #9230


>---------------------------------------------------------------

c6d4ae6f437fb041ea70f3d2b4f7f0d03ff797bf
 testsuite/driver/testlib.py | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/testsuite/driver/testlib.py b/testsuite/driver/testlib.py
index 3093982..87e37d5 100644
--- a/testsuite/driver/testlib.py
+++ b/testsuite/driver/testlib.py
@@ -920,7 +920,7 @@ def run_command( name, way, cmd ):
 
 def ghci_script_without_flag(flag):
     def apply(name, way, script):
-        overrides = filter(lambda f: f != flag, getTestOpts().compiler_always_flags)
+        overrides = [f for f in getTestOpts().compiler_always_flags if f != flag]
         return ghci_script_override_default_flags(overrides)(name, way, script)
 
     return apply
@@ -933,7 +933,7 @@ def ghci_script_override_default_flags(overrides):
 
 def ghci_script( name, way, script, override_flags = None ):
     # Use overriden default flags when given
-    if override_flags:
+    if override_flags is not None:
         default_flags = override_flags
     else:
         default_flags = getTestOpts().compiler_always_flags
@@ -973,14 +973,14 @@ def compile_fail_override_default_flags(overrides):
 
 def compile_without_flag(flag):
     def apply(name, way, extra_opts):
-        overrides = filter(lambda f: f != flag, getTestOpts().compiler_always_flags)
+        overrides = [f for f in getTestOpts().compiler_always_flags if f != flag]
         return compile_override_default_flags(overrides)(name, way, extra_opts)
 
     return apply
 
 def compile_fail_without_flag(flag):
     def apply(name, way, extra_opts):
-        overrides = filter(lambda f: f != flag, getTestOpts().compiler_always_flags)
+        overrides = [f for f in getTestOpts.compiler_always_flags if f != flag]
         return compile_fail_override_default_flags(overrides)(name, way, extra_opts)
 
     return apply
@@ -1225,7 +1225,7 @@ def simple_build( name, way, extra_hc_opts, should_fail, top_mod, link, addsuf,
     else:
         cmd_prefix = getTestOpts().compile_cmd_prefix + ' '
 
-    if override_flags:
+    if override_flags is not None:
         comp_flags = copy.copy(override_flags)
     else:
         comp_flags = copy.copy(getTestOpts().compiler_always_flags)



More information about the ghc-commits mailing list