[Scipy-svn] r6518 - branches/0.8.x/scipy/weave

scipy-svn at scipy.org scipy-svn at scipy.org
Thu Jun 17 09:28:06 EDT 2010


Author: rgommers
Date: 2010-06-17 08:28:06 -0500 (Thu, 17 Jun 2010)
New Revision: 6518

Modified:
   branches/0.8.x/scipy/weave/blitz_tools.py
   branches/0.8.x/scipy/weave/bytecodecompiler.py
Log:
BUG: string exceptions are invalid syntax in Python >=2.6. Fixes #1193.

Backport of r6517.

Modified: branches/0.8.x/scipy/weave/blitz_tools.py
===================================================================
--- branches/0.8.x/scipy/weave/blitz_tools.py	2010-06-17 13:25:14 UTC (rev 6517)
+++ branches/0.8.x/scipy/weave/blitz_tools.py	2010-06-17 13:28:06 UTC (rev 6518)
@@ -32,7 +32,10 @@
     #    of time.  It also can cause core-dumps if the sizes of the inputs
     #    aren't compatible.
     if check_size and not size_check.check_expr(expr,local_dict,global_dict):
-        raise 'inputs failed to pass size check.'
+        if sys.version_info < (2, 6):
+            raise "inputs failed to pass size check."
+        else:
+            raise ValueError("inputs failed to pass size check.")
 
     # 2. try local cache
     try:

Modified: branches/0.8.x/scipy/weave/bytecodecompiler.py
===================================================================
--- branches/0.8.x/scipy/weave/bytecodecompiler.py	2010-06-17 13:25:14 UTC (rev 6517)
+++ branches/0.8.x/scipy/weave/bytecodecompiler.py	2010-06-17 13:28:06 UTC (rev 6518)
@@ -6,6 +6,7 @@
 #**************************************************************************#
 #*  *#
 #**************************************************************************#
+import sys
 import inspect
 import accelerate_tools
 
@@ -237,7 +238,10 @@
         elif goto is None:
             return next # Normal
         else:
-            raise 'xx'
+            if sys.version_info < (2, 6):
+                raise "Executing code failed."
+            else:
+                raise ValueError("Executing code failed.")
 
     symbols = { 0: 'less', 1: 'lesseq', 2: 'equal', 3: 'notequal',
                 4: 'greater', 5: 'greatereq', 6: 'in', 7: 'not in',
@@ -977,7 +981,6 @@
         var_name = self.codeobject.co_names[var_num]
 
         # First, figure out who owns this global
-        import sys
         myHash = id(self.function.func_globals)
         for module_name in sys.modules.keys():
             module = sys.modules[module_name]




More information about the Scipy-svn mailing list