Commits

Armin Rigo  committed 710f8fc

Python 3.

  • Participants
  • Parent commits a5b62f2

Comments (0)

Files changed (3)

File cffi/ffiplatform.py

 
 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):
             "the keywords to verify() contains unsupported object %r" % (x,))
 
 def flatten(x):
-    import cStringIO
     f = cStringIO.StringIO()
     _flatten(x, f)
     return f.getvalue()

File cffi/vengine_cpy.py

                     "not implemented in verify(): %r" % name)
             try:
                 method(tp, realname)
-            except Exception, e:
+            except Exception as e:
                 model.attach_exception_info(e, name)
                 raise
 
             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
 

File cffi/vengine_gen.py

                     "not implemented in verify(): %r" % name)
             try:
                 method(tp, realname)
-            except Exception, e:
+            except Exception as e:
                 model.attach_exception_info(e, name)
                 raise
 
             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