[pypy-svn] r50883 - pypy/dist/pypy/rpython/lltypesystem

fijal at codespeak.net fijal at codespeak.net
Tue Jan 22 17:04:04 CET 2008


Author: fijal
Date: Tue Jan 22 17:04:03 2008
New Revision: 50883

Modified:
   pypy/dist/pypy/rpython/lltypesystem/rffi.py
Log:
Automatic casts of external function calls. Helps a bit with rffi on 64 bit when int is 32 bit.


Modified: pypy/dist/pypy/rpython/lltypesystem/rffi.py
==============================================================================
--- pypy/dist/pypy/rpython/lltypesystem/rffi.py	(original)
+++ pypy/dist/pypy/rpython/lltypesystem/rffi.py	Tue Jan 22 17:04:03 2008
@@ -140,13 +140,18 @@
             if before: before()
             # NB. it is essential that no exception checking occurs after
             # the call to before(), because we don't have the GIL any more!
-        result = funcptr(*real_args)
+        res = funcptr(*real_args)
         if invoke_around_handlers:
             if after: after()
         for i, TARGET in unrolling_arg_tps:
             if to_free[i]:
                 lltype.free(to_free[i], flavor='raw')
-        return result
+        if rarithmetic.r_int is not r_int:
+            if result is INT:
+                return cast(lltype.Signed, res)
+            elif result is UINT:
+                return cast(lltype.Unsigned, res)
+        return res
     wrapper._annspecialcase_ = 'specialize:ll'
     wrapper._always_inline_ = True
     # for debugging, stick ll func ptr to that



More information about the Pypy-commit mailing list