[pypy-commit] pypy py3k: Some py3k fixes in the _ffi module

amauryfa noreply at buildbot.pypy.org
Wed Sep 12 20:57:20 CEST 2012


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r57302:aca3138e7e98
Date: 2012-09-08 00:11 +0200
http://bitbucket.org/pypy/pypy/changeset/aca3138e7e98/

Log:	Some py3k fixes in the _ffi module

diff --git a/pypy/module/_ffi/app_struct.py b/pypy/module/_ffi/app_struct.py
--- a/pypy/module/_ffi/app_struct.py
+++ b/pypy/module/_ffi/app_struct.py
@@ -17,5 +17,5 @@
         dic['_struct_'] = struct_descr
 
 
-class Structure(object):
-    __metaclass__ = MetaStructure
+class Structure(metaclass=MetaStructure):
+    pass
diff --git a/pypy/module/_ffi/test/test_funcptr.py b/pypy/module/_ffi/test/test_funcptr.py
--- a/pypy/module/_ffi/test/test_funcptr.py
+++ b/pypy/module/_ffi/test/test_funcptr.py
@@ -579,7 +579,7 @@
         pow = libm.getfunc('pow', [types.double, types.double], types.double)
         try:
             pow(2, 3)
-        except ValueError, e:
+        except ValueError as e:
             assert e.message.startswith('Procedure called with')
         else:
             assert 0, 'test must assert, wrong calling convention'
@@ -600,7 +600,7 @@
         wrong_sleep = wrong_kernel.getfunc('Sleep', [types.uint], types.void)
         try:
             wrong_sleep(10)
-        except ValueError, e:
+        except ValueError as e:
             assert e.message.startswith('Procedure called with')
         else:
             assert 0, 'test must assert, wrong calling convention'
@@ -616,7 +616,7 @@
                 [types.double, types.double], types.double, FUNCFLAG_STDCALL)
         try:
             wrong_pow(2, 3) == 8
-        except ValueError, e:
+        except ValueError as e:
             assert e.message.startswith('Procedure called with')
         else:
             assert 0, 'test must assert, wrong calling convention'
diff --git a/pypy/module/_ffi/test/test_struct.py b/pypy/module/_ffi/test/test_struct.py
--- a/pypy/module/_ffi/test/test_struct.py
+++ b/pypy/module/_ffi/test/test_struct.py
@@ -172,15 +172,15 @@
         struct.setfield('uint', 43)
         assert struct.getfield('uint') == 43
         struct.setfield('ulong', -1)
-        assert struct.getfield('ulong') == sys.maxint*2 + 1
-        struct.setfield('ulong', sys.maxint*2 + 2)
+        assert struct.getfield('ulong') == sys.maxsize*2 + 1
+        struct.setfield('ulong', sys.maxsize*2 + 2)
         assert struct.getfield('ulong') == 0
         struct.setfield('char', 'a')
         assert struct.getfield('char') == 'a'
-        struct.setfield('unichar', u'\u1234')
-        assert struct.getfield('unichar') == u'\u1234'
+        struct.setfield('unichar', '\u1234')
+        assert struct.getfield('unichar') == '\u1234'
         struct.setfield('ptr', -1)
-        assert struct.getfield('ptr') == sys.maxint*2 + 1
+        assert struct.getfield('ptr') == sys.maxsize*2 + 1
     
     def test_getfield_setfield_longlong(self):
         import sys


More information about the pypy-commit mailing list