Commits

Ronan Lamy  committed 113bc72 Merge

Merged in techtonik/pypy (pull request #239)

code-guide: Use `as` in exception handling code. Fix

  • Participants
  • Parent commits 6c48610, acd4c03

Comments (0)

Files changed (5)

File pypy/config/pypyoption.py

             try:
                 for name in modlist:
                     __import__(name)
-            except (ImportError, CompilationError, py.test.skip.Exception), e:
+            except (ImportError, CompilationError, py.test.skip.Exception) as e:
                 errcls = e.__class__.__name__
                 raise Exception(
                     "The module %r is disabled\n" % (modname,) +

File pypy/doc/coding-guide.rst

         while True:
             try:
                 w_key = space.next(w_iter)
-            except OperationError, e:
+            except OperationError as e:
                 if not e.match(space, space.w_StopIteration):
                     raise       # re-raise other app-level exceptions
                 break
 
     try:
         ...
-    except OperationError, e:
+    except OperationError as e:
         if not e.match(space, space.w_XxxError):
             raise
         ...

File rpython/config/config.py

     def setoption(self, config, value, who):
         try:
             super(IntOption, self).setoption(config, int(value), who)
-        except TypeError, e:
+        except TypeError as e:
             raise ConfigError(*e.args)
 
 
     def setoption(self, config, value, who):
         try:
             super(FloatOption, self).setoption(config, float(value), who)
-        except TypeError, e:
+        except TypeError as e:
             raise ConfigError(*e.args)
 
 
     def setoption(self, config, value, who):
         try:
             super(StrOption, self).setoption(config, value, who)
-        except TypeError, e:
+        except TypeError as e:
             raise ConfigError(*e.args)
 
 
         try:
             value = self.convert_from_cmdline(value)
             self.config.setoption(self.option._name, value, who='cmdline')
-        except ConfigError, e:
+        except ConfigError as e:
             # This OptionValueError is going to exit the translate.py process.
             # Now is the last chance to print the warnings, which might give
             # more information...  hack.

File rpython/tool/runsubprocess.py

         args = eval(operation)
         try:
             results = _run(*args)
-        except EnvironmentError, e:
+        except EnvironmentError as e:
             results = (None, str(e))
         sys.stdout.write('%r\n' % (results,))
         sys.stdout.flush()

File rpython/tool/version.py

     try:
         p = Popen([str(hgexe), 'version', '-q'],
                   stdout=PIPE, stderr=PIPE, env=env)
-    except OSError, e:
+    except OSError as e:
         maywarn(e)
         return default_retval
 
             [str(gitexe), 'rev-parse', 'HEAD'],
             stdout=PIPE, stderr=PIPE, cwd=root
             )
-    except OSError, e:
+    except OSError as e:
         maywarn(e, 'Git')
         return default_retval
     if p.wait() != 0: