Repository : ssh://darcs.haskell.org//srv/darcs/testsuite

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/c1814046fe9e264e21f98d1dfeb35abc4c5eef49

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

commit c1814046fe9e264e21f98d1dfeb35abc4c5eef49
Author: Ian Lynagh <[email protected]>
Date:   Sun Sep 25 17:01:24 2011 +0100

    Tell python to let us use the "with X:" syntax
    
    This fixes the testsuite driver with python 2.5. Patch from Florian Weimer.

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

 driver/testlib.py |   12 ++++--------
 1 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/driver/testlib.py b/driver/testlib.py
index 3b3644c..085dc01 100644
--- a/driver/testlib.py
+++ b/driver/testlib.py
@@ -2,6 +2,9 @@
 # (c) Simon Marlow 2002
 #
 
+# This allows us to use the "with X:" syntax with python 2.5:
+from __future__ import with_statement
+
 import sys
 import os
 import errno
@@ -1623,15 +1626,8 @@ def mkPath(curdir, path):
 
 def addTestFilesWritten(name, fn):
     if config.use_threads:
-        # We would use
-        #     with t.lockFilesWritten:
-        #         addTestFilesWrittenHelper(name, fn)
-        # but old versions of python fail with "SyntaxError: invalid syntax"
-        t.lockFilesWritten.acquire()
-        try:
+        with t.lockFilesWritten:
             addTestFilesWrittenHelper(name, fn)
-        finally:
-            t.lockFilesWritten.release()
     else:
         addTestFilesWrittenHelper(name, fn)
 



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to