[pypy-commit] pypy py3k: Fix syntax of applevel code

amauryfa noreply at buildbot.pypy.org
Tue Oct 18 00:38:03 CEST 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r48171:ce1ccc552d38
Date: 2011-10-17 23:46 +0200
http://bitbucket.org/pypy/pypy/changeset/ce1ccc552d38/

Log:	Fix syntax of applevel code

diff --git a/pypy/objspace/std/objecttype.py b/pypy/objspace/std/objecttype.py
--- a/pypy/objspace/std/objecttype.py
+++ b/pypy/objspace/std/objecttype.py
@@ -152,7 +152,7 @@
     else:
         args = getnewargs()
         if not isinstance(args, tuple):
-            raise TypeError, "__getnewargs__ should return a tuple"
+            raise TypeError("__getnewargs__ should return a tuple")
 
     try:
         getstate = obj.__getstate__
@@ -201,7 +201,7 @@
     import copy_reg
     slotnames = copy_reg._slotnames(cls)
     if not isinstance(slotnames, list) and slotnames is not None:
-        raise TypeError, "copy_reg._slotnames didn't return a list or None"
+        raise TypeError("copy_reg._slotnames didn't return a list or None")
     return slotnames
 ''', filename=__file__)
 
diff --git a/pypy/objspace/std/typeobject.py b/pypy/objspace/std/typeobject.py
--- a/pypy/objspace/std/typeobject.py
+++ b/pypy/objspace/std/typeobject.py
@@ -924,7 +924,7 @@
             if klass not in mro:
                 mro.append(klass)
                 if not isinstance(klass.__bases__, tuple):
-                    raise TypeError, '__bases__ must be a tuple'
+                    raise TypeError('__bases__ must be a tuple')
                 stack += klass.__bases__[::-1]
         return mro
 """, filename=__file__).interphook("abstract_mro")
diff --git a/pypy/translator/goal/app_main.py b/pypy/translator/goal/app_main.py
--- a/pypy/translator/goal/app_main.py
+++ b/pypy/translator/goal/app_main.py
@@ -61,7 +61,7 @@
             if softspace:
                 stdout.write('\n')
 
-    except SystemExit, e:
+    except SystemExit as e:
         handle_sys_exit(e)
     except:
         display_exception()
@@ -377,7 +377,7 @@
             funcarg = ''.join(remaining)
         else:
             try:
-                funcarg = iterargv.next()
+                funcarg = next(iterargv)
             except StopIteration:
                 if len(c) == 1:
                     c = '-' + c
@@ -409,7 +409,7 @@
         # Else interpret the rest of the argument character by character
         else:
             iterarg = iter(arg)
-            iterarg.next()     # skip the '-'
+            next(iterarg)      # skip the '-'
             for c in iterarg:
                 if c not in cmdline_options:
                     raise CommandLineError('Unknown option: -%s' % (c,))
@@ -560,7 +560,7 @@
                         f = open(python_startup)
                         startup = f.read()
                         f.close()
-                    except IOError, e:
+                    except IOError as e:
                         print("Could not open PYTHONSTARTUP", file=sys.stderr)
                         print("IOError:", e, file=sys.stderr)
                     else:
@@ -609,7 +609,7 @@
                     args = (execfile, filename, mainmodule.__dict__)
             success = run_toplevel(*args)
 
-    except SystemExit, e:
+    except SystemExit as e:
         status = e.code
         if inspect_requested():
             display_exception()
@@ -622,7 +622,7 @@
         try:
             from _pypy_interact import interactive_console
             success = run_toplevel(interactive_console, mainmodule)
-        except SystemExit, e:
+        except SystemExit as e:
             status = e.code
         else:
             status = not success


More information about the pypy-commit mailing list