Commits

Ronan Lamy committed 6045f68

modernise raise syntax

  • Participants
  • Parent commits 5385c2f

Comments (0)

Files changed (9)

File rpython/translator/backendopt/all.py

     try:
         mod = __import__(module, {}, {}, ['__doc__'])
     except ImportError, e:
-        raise Exception, "Import error loading %s: %s" % (dottedname, e)
+        raise Exception("Import error loading %s: %s" % (dottedname, e))
 
     try:
         func = getattr(mod, name)
     except AttributeError:
-        raise Exception, "Function %s not found in module" % dottedname
+        raise Exception("Function %s not found in module" % dottedname)
 
     return func
 

File rpython/translator/c/funcgen.py

             else:
                 return self.db.get(value)
         else:
-            raise TypeError, "expr(%r)" % (v,)
+            raise TypeError("expr(%r)" % (v,))
 
     # ____________________________________________________________
 

File rpython/translator/c/node.py

     elif hasattr(fnobj._callable, "c_name"):
         return []
     else:
-        raise ValueError, "don't know how to generate code for %r" % (fnobj,)
+        raise ValueError("don't know how to generate code for %r" % (fnobj,))
 
 class ExtType_OpaqueNode(ContainerNode):
     nodekind = 'rpyopaque'

File rpython/translator/c/test/test_extfunc.py

     elif output.startswith('T'):
         return output[1:]
     else:
-        raise ValueError, 'probing for env var returned %r' % (output,)
+        raise ValueError('probing for env var returned %r' % (output,))
 
 def test_dictlike_environ_getitem():
     def fn(s):

File rpython/translator/driver.py

             if os.WIFEXITED(status):
                 status = os.WEXITSTATUS(status)
                 if status != 0:
-                    raise Exception, "instrumentation child failed: %d" % status
+                    raise Exception("instrumentation child failed: %d" % status)
             else:
-                raise Exception, "instrumentation child aborted"
+                raise Exception("instrumentation child aborted")
             import array, struct
             n = datafile.size()//struct.calcsize('L')
             datafile = datafile.open('rb')

File rpython/translator/gensupp.py

         before generating any new names."""
         for name in txt.split():
             if name in self.seennames:
-                raise NameError, "%s has already been seen!"
+                raise NameError("%s has already been seen!")
             self.seennames[name] = 1
 
     def _ensure_unique(self, basename):

File rpython/translator/goal/bpnn.py

 
     def update(self, inputs):
         if len(inputs) != self.ni-1:
-            raise ValueError, 'wrong number of inputs'
+            raise ValueError('wrong number of inputs')
 
         # input activations
         for i in range(self.ni-1):
 
     def backPropagate(self, targets, N, M):
         if len(targets) != self.no:
-            raise ValueError, 'wrong number of target values'
+            raise ValueError('wrong number of target values')
 
         # calculate error terms for output
         output_deltas = [0.0] * self.no

File rpython/translator/platform/windows.py

     try:
         subprocess.check_output([cc, '--version'])
     except:
-        raise ValueError,"Could not find compiler specified by cc option" + \
-                " '%s', it must be a valid exe file on your path"%cc
+        raise ValueError("Could not find compiler specified by cc option '%s',"
+                         " it must be a valid exe file on your path" % cc)
     return MingwPlatform(cc)
 
 def Windows(cc=None):
     raise Exception("Win64 is not supported.  You must either build for Win32"
                     " or contribute the missing support in PyPy.")
     return _get_compiler_type(cc, True)
-    
+
 def _get_msvc_env(vsver, x64flag):
     try:
         toolsdir = os.environ['VS%sCOMNTOOLS' % vsver]
     name = "msvc"
     so_ext = 'dll'
     exe_ext = 'exe'
-    
+
     relevant_environ = ('PATH', 'INCLUDE', 'LIB')
 
     cc = 'cl.exe'
     standalone_only = ()
     shared_only = ()
     environ = None
-    
+
     def __init__(self, cc=None, x64=False):
         self.x64 = x64
         msvc_compiler_environ = find_msvc_env(x64)
         else:
             masm32 = 'ml.exe'
             masm64 = 'ml64.exe'
-        
+
         if x64:
             self.masm = masm64
         else:
             definitions.append(('CREATE_PCH', '/Ycstdafx.h /Fpstdafx.pch /FIstdafx.h'))
             definitions.append(('USE_PCH', '/Yustdafx.h /Fpstdafx.pch /FIstdafx.h'))
             rules.append(('$(OBJECTS)', 'stdafx.pch', []))
-            rules.append(('stdafx.pch', 'stdafx.h', 
+            rules.append(('stdafx.pch', 'stdafx.h',
                '$(CC) stdafx.c /c /nologo $(CFLAGS) $(CFLAGSEXTRA) '
                '$(CREATE_PCH) $(INCLUDEDIRS)'))
-            rules.append(('.c.obj', '', 
+            rules.append(('.c.obj', '',
                     '$(CC) /nologo $(CFLAGS) $(CFLAGSEXTRA) $(USE_PCH) '
                     '/Fo$@ /c $< $(INCLUDEDIRS)'))
             #Do not use precompiled headers for some files
                         '/Fo%s /c %s $(INCLUDEDIRS)' %(target, f)))
 
         else:
-            rules.append(('.c.obj', '', 
+            rules.append(('.c.obj', '',
                           '$(CC) /nologo $(CFLAGS) $(CFLAGSEXTRA) '
                           '/Fo$@ /c $< $(INCLUDEDIRS)'))
 
 
         for rule in rules:
             m.rule(*rule)
-        
+
         if self.version < 80:
             m.rule('$(TARGET)', '$(OBJECTS)',
                     [ '$(CC_LINK) /nologo $(LDFLAGS) $(LDFLAGSEXTRA) /out:$@' +\

File rpython/translator/translator.py

                 print >>f, "   ",op
             print >>f, '--end--'
             return
-        raise TypeError, "don't know about %r" % x
+        raise TypeError("don't know about %r" % x)
 
 
     def view(self):