[pypy-commit] cffi default: Python 3.

arigo noreply at buildbot.pypy.org
Fri Nov 30 23:06:07 CET 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: 
Changeset: r1089:710f8fcd1563
Date: 2012-11-30 14:06 -0800
http://bitbucket.org/cffi/cffi/changeset/710f8fcd1563/

Log:	Python 3.

diff --git a/cffi/ffiplatform.py b/cffi/ffiplatform.py
--- a/cffi/ffiplatform.py
+++ b/cffi/ffiplatform.py
@@ -81,8 +81,10 @@
 
 try:
     int_or_long = (int, long)
+    import cStringIO
 except NameError:
     int_or_long = int      # Python 3
+    import io as cStringIO
 
 def _flatten(x, f):
     if isinstance(x, str):
@@ -104,7 +106,6 @@
             "the keywords to verify() contains unsupported object %r" % (x,))
 
 def flatten(x):
-    import cStringIO
     f = cStringIO.StringIO()
     _flatten(x, f)
     return f.getvalue()
diff --git a/cffi/vengine_cpy.py b/cffi/vengine_cpy.py
--- a/cffi/vengine_cpy.py
+++ b/cffi/vengine_cpy.py
@@ -165,7 +165,7 @@
                     "not implemented in verify(): %r" % name)
             try:
                 method(tp, realname)
-            except Exception, e:
+            except Exception as e:
                 model.attach_exception_info(e, name)
                 raise
 
@@ -175,7 +175,7 @@
             method = getattr(self, '_%s_cpy_%s' % (step_name, kind))
             try:
                 method(tp, realname, module, **kwds)
-            except Exception, e:
+            except Exception as e:
                 model.attach_exception_info(e, name)
                 raise
 
diff --git a/cffi/vengine_gen.py b/cffi/vengine_gen.py
--- a/cffi/vengine_gen.py
+++ b/cffi/vengine_gen.py
@@ -80,7 +80,7 @@
                     "not implemented in verify(): %r" % name)
             try:
                 method(tp, realname)
-            except Exception, e:
+            except Exception as e:
                 model.attach_exception_info(e, name)
                 raise
 
@@ -90,7 +90,7 @@
             method = getattr(self, '_%s_gen_%s' % (step_name, kind))
             try:
                 method(tp, realname, module, **kwds)
-            except Exception, e:
+            except Exception as e:
                 model.attach_exception_info(e, name)
                 raise
 


More information about the pypy-commit mailing list