[pypy-svn] r73641 - pypy/branch/cpython-extension/pypy/module/cpyext

xoraxax at codespeak.net xoraxax at codespeak.net
Sun Apr 11 13:07:35 CEST 2010


Author: xoraxax
Date: Sun Apr 11 13:07:33 2010
New Revision: 73641

Modified:
   pypy/branch/cpython-extension/pypy/module/cpyext/longobject.py
Log:
Fix cast and test.

Modified: pypy/branch/cpython-extension/pypy/module/cpyext/longobject.py
==============================================================================
--- pypy/branch/cpython-extension/pypy/module/cpyext/longobject.py	(original)
+++ pypy/branch/cpython-extension/pypy/module/cpyext/longobject.py	Sun Apr 11 13:07:33 2010
@@ -1,5 +1,5 @@
 from pypy.rpython.lltypesystem import lltype, rffi
-from pypy.module.cpyext.api import cpython_api, PyObject, build_type_checkers
+from pypy.module.cpyext.api import cpython_api, PyObject, build_type_checkers, ADDR
 from pypy.objspace.std.longobject import W_LongObject
 from pypy.interpreter.error import OperationError
 
@@ -9,7 +9,7 @@
 @cpython_api([lltype.Signed], PyObject)
 def PyLong_FromLong(space, val):
     """Return a new PyLongObject object from v, or NULL on failure."""
-    return space.wrap(val)
+    return space.newlong(val)
 
 @cpython_api([PyObject], rffi.ULONG, error=0)
 def PyLong_AsUnsignedLong(space, w_long):
@@ -25,5 +25,5 @@
     can be retrieved from the resulting value using PyLong_AsVoidPtr().
 
     If the integer is larger than LONG_MAX, a positive long integer is returned."""
-    return space.wrap(rffi.cast(rffi.LONG, p))
+    return space.wrap(rffi.cast(ADDR, p))
 



More information about the Pypy-commit mailing list