[pypy-svn] pypy real-voidp: s/VOIDP_real/VOIDP/g

amauryfa commits-noreply at bitbucket.org
Tue Mar 1 20:09:18 CET 2011


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: real-voidp
Changeset: r42370:32faea844dec
Date: 2011-03-01 20:09 +0100
http://bitbucket.org/pypy/pypy/changeset/32faea844dec/

Log:	s/VOIDP_real/VOIDP/g

diff --git a/pypy/module/cpyext/pyobject.py b/pypy/module/cpyext/pyobject.py
--- a/pypy/module/cpyext/pyobject.py
+++ b/pypy/module/cpyext/pyobject.py
@@ -454,6 +454,6 @@
 
 #___________________________________________________________
 
- at cpython_api([rffi.VOIDP_real], lltype.Signed, error=CANNOT_FAIL)
+ at cpython_api([rffi.VOIDP], lltype.Signed, error=CANNOT_FAIL)
 def _Py_HashPointer(space, ptr):
     return rffi.cast(lltype.Signed, ptr)

diff --git a/pypy/module/cpyext/typeobjectdefs.py b/pypy/module/cpyext/typeobjectdefs.py
--- a/pypy/module/cpyext/typeobjectdefs.py
+++ b/pypy/module/cpyext/typeobjectdefs.py
@@ -11,7 +11,7 @@
 P, FT, PyO = Ptr, FuncType, PyObject
 PyOPtr = Ptr(lltype.Array(PyO, hints={'nolength': True}))
 
-freefunc = P(FT([rffi.VOIDP_real], Void))
+freefunc = P(FT([rffi.VOIDP], Void))
 destructor = P(FT([PyO], Void))
 printfunc = P(FT([PyO, FILEP, rffi.INT_real], rffi.INT))
 getattrfunc = P(FT([PyO, rffi.CCHARP], PyO))
@@ -46,14 +46,14 @@
 objobjargproc = P(FT([PyO, PyO, PyO], rffi.INT_real))
 
 objobjproc = P(FT([PyO, PyO], rffi.INT_real))
-visitproc = P(FT([PyO, rffi.VOIDP_real], rffi.INT_real))
-traverseproc = P(FT([PyO, visitproc, rffi.VOIDP_real], rffi.INT_real))
+visitproc = P(FT([PyO, rffi.VOIDP], rffi.INT_real))
+traverseproc = P(FT([PyO, visitproc, rffi.VOIDP], rffi.INT_real))
 
-getter = P(FT([PyO, rffi.VOIDP_real], PyO))
-setter = P(FT([PyO, PyO, rffi.VOIDP_real], rffi.INT_real))
+getter = P(FT([PyO, rffi.VOIDP], PyO))
+setter = P(FT([PyO, PyO, rffi.VOIDP], rffi.INT_real))
 
-wrapperfunc = P(FT([PyO, PyO, rffi.VOIDP_real], PyO))
-wrapperfunc_kwds = P(FT([PyO, PyO, rffi.VOIDP_real, PyO], PyO))
+wrapperfunc = P(FT([PyO, PyO, rffi.VOIDP], PyO))
+wrapperfunc_kwds = P(FT([PyO, PyO, rffi.VOIDP, PyO], PyO))
 
 
 PyGetSetDef = cpython_struct("PyGetSetDef", (
@@ -61,7 +61,7 @@
     ("get", getter),
     ("set", setter),
     ("doc", rffi.CCHARP),
-    ("closure", rffi.VOIDP_real),
+    ("closure", rffi.VOIDP),
 ))
 
 PyNumberMethods = cpython_struct("PyNumberMethods", (

diff --git a/pypy/translator/c/test/test_database.py b/pypy/translator/c/test/test_database.py
--- a/pypy/translator/c/test/test_database.py
+++ b/pypy/translator/c/test/test_database.py
@@ -5,7 +5,7 @@
 from pypy.objspace.flow.model import Constant, Variable, SpaceOperation
 from pypy.objspace.flow.model import Block, Link, FunctionGraph
 from pypy.rpython.typesystem import getfunctionptr
-from pypy.rpython.lltypesystem.rffi import VOIDP_real, INT_real, INT
+from pypy.rpython.lltypesystem.rffi import VOIDP, INT_real, INT
 
 
 def dump_on_stdout(database):
@@ -223,7 +223,7 @@
     dump_on_stdout(db)
 
 def test_voidp():
-    A = VOIDP_real
+    A = VOIDP
     db = LowLevelDatabase()
     assert db.gettype(A) == "void *@"
 

diff --git a/pypy/module/cpyext/typeobject.py b/pypy/module/cpyext/typeobject.py
--- a/pypy/module/cpyext/typeobject.py
+++ b/pypy/module/cpyext/typeobject.py
@@ -159,7 +159,7 @@
             if not struct:
                 continue
             func = getattr(struct, slot_names[1])
-        func_voidp = rffi.cast(rffi.VOIDP_real, func)
+        func_voidp = rffi.cast(rffi.VOIDP, func)
         if not func:
             continue
         if wrapper_func is None and wrapper_func_kwds is None:

diff --git a/pypy/module/cpyext/object.py b/pypy/module/cpyext/object.py
--- a/pypy/module/cpyext/object.py
+++ b/pypy/module/cpyext/object.py
@@ -20,7 +20,7 @@
     return lltype.malloc(rffi.VOIDP.TO, size,
                          flavor='raw', zero=True)
 
- at cpython_api([rffi.VOIDP_real], lltype.Void)
+ at cpython_api([rffi.VOIDP], lltype.Void)
 def PyObject_FREE(space, ptr):
     lltype.free(ptr, flavor='raw')
 
@@ -42,14 +42,14 @@
         w_obj = PyObject_InitVar(space, py_objvar, type, itemcount)
     return py_obj
 
- at cpython_api([rffi.VOIDP_real], lltype.Void)
+ at cpython_api([rffi.VOIDP], lltype.Void)
 def PyObject_Del(space, obj):
     lltype.free(obj, flavor='raw')
 
 @cpython_api([PyObject], lltype.Void)
 def PyObject_dealloc(space, obj):
     pto = obj.c_ob_type
-    obj_voidp = rffi.cast(rffi.VOIDP_real, obj)
+    obj_voidp = rffi.cast(rffi.VOIDP, obj)
     generic_cpy_call(space, pto.c_tp_free, obj_voidp)
     if pto.c_tp_flags & Py_TPFLAGS_HEAPTYPE:
         Py_DecRef(space, rffi.cast(PyObject, pto))
@@ -58,11 +58,11 @@
 def _PyObject_GC_New(space, type):
     return _PyObject_New(space, type)
 
- at cpython_api([rffi.VOIDP_real], lltype.Void)
+ at cpython_api([rffi.VOIDP], lltype.Void)
 def PyObject_GC_Del(space, obj):
     PyObject_Del(space, obj)
 
- at cpython_api([rffi.VOIDP_real], lltype.Void)
+ at cpython_api([rffi.VOIDP], lltype.Void)
 def PyObject_GC_Track(space, op):
     """Adds the object op to the set of container objects tracked by the
     collector.  The collector can run at unexpected times so objects must be
@@ -71,7 +71,7 @@
     end of the constructor."""
     pass
 
- at cpython_api([rffi.VOIDP_real], lltype.Void)
+ at cpython_api([rffi.VOIDP], lltype.Void)
 def PyObject_GC_UnTrack(space, op):
     """Remove the object op from the set of container objects tracked by the
     collector.  Note that PyObject_GC_Track() can be called again on

diff --git a/pypy/module/cpyext/stubs.py b/pypy/module/cpyext/stubs.py
--- a/pypy/module/cpyext/stubs.py
+++ b/pypy/module/cpyext/stubs.py
@@ -1248,7 +1248,7 @@
     reload the module if it was already imported.)"""
     raise NotImplementedError
 
- at cpython_api([rffi.CCHARP, rffi.VOIDP_real], rffi.INT_real, error=-1)
+ at cpython_api([rffi.CCHARP, rffi.VOIDP], rffi.INT_real, error=-1)
 def PyImport_AppendInittab(space, name, initfunc):
     """Add a single module to the existing table of built-in modules.  This is a
     convenience wrapper around PyImport_ExtendInittab(), returning -1 if

diff --git a/pypy/rpython/lltypesystem/rffi.py b/pypy/rpython/lltypesystem/rffi.py
--- a/pypy/rpython/lltypesystem/rffi.py
+++ b/pypy/rpython/lltypesystem/rffi.py
@@ -559,8 +559,7 @@
 r_singlefloat = rarithmetic.r_singlefloat
 
 # void *   - for now, represented as char *
-VOIDP_real = lltype.Ptr(lltype.Array(lltype.Char, hints={'nolength': True, 'render_as_void': True}))
-VOIDP = VOIDP_real
+VOIDP = lltype.Ptr(lltype.Array(lltype.Char, hints={'nolength': True, 'render_as_void': True}))
 NULL = None
 
 # void **

diff --git a/pypy/module/cpyext/stubgen.py b/pypy/module/cpyext/stubgen.py
--- a/pypy/module/cpyext/stubgen.py
+++ b/pypy/module/cpyext/stubgen.py
@@ -36,7 +36,7 @@
 
 C_TYPE_TO_PYPY_TYPE_ARGS = C_TYPE_TO_PYPY_TYPE.copy()
 C_TYPE_TO_PYPY_TYPE_ARGS.update({
-    "void": "rffi.VOIDP_real",
+    "void": "rffi.VOIDP",
     })
 
 

diff --git a/pypy/module/cpyext/test/test_longobject.py b/pypy/module/cpyext/test/test_longobject.py
--- a/pypy/module/cpyext/test/test_longobject.py
+++ b/pypy/module/cpyext/test/test_longobject.py
@@ -94,7 +94,7 @@
     def test_as_voidptr(self, space, api):
         w_l = api.PyLong_FromVoidPtr(lltype.nullptr(rffi.VOIDP.TO))
         assert space.unwrap(w_l) == 0L
-        assert api.PyLong_AsVoidPtr(w_l) == lltype.nullptr(rffi.VOIDP_real.TO)
+        assert api.PyLong_AsVoidPtr(w_l) == lltype.nullptr(rffi.VOIDP.TO)
 
     def test_sign_and_bits(self, space, api):
         if space.is_true(space.lt(space.sys.get('version_info'),

diff --git a/pypy/module/cpyext/longobject.py b/pypy/module/cpyext/longobject.py
--- a/pypy/module/cpyext/longobject.py
+++ b/pypy/module/cpyext/longobject.py
@@ -151,7 +151,7 @@
         pend[0] = rffi.ptradd(str, len(s))
     return space.call_function(space.w_long, w_str, w_base)
 
- at cpython_api([rffi.VOIDP_real], PyObject)
+ at cpython_api([rffi.VOIDP], PyObject)
 def PyLong_FromVoidPtr(space, p):
     """Create a Python integer or long integer from the pointer p. The pointer value
     can be retrieved from the resulting value using PyLong_AsVoidPtr().
@@ -159,14 +159,14 @@
     If the integer is larger than LONG_MAX, a positive long integer is returned."""
     return space.wrap(rffi.cast(ADDR, p))
 
- at cpython_api([PyObject], rffi.VOIDP_real, error=lltype.nullptr(rffi.VOIDP_real.TO))
+ at cpython_api([PyObject], rffi.VOIDP, error=lltype.nullptr(rffi.VOIDP.TO))
 def PyLong_AsVoidPtr(space, w_long):
     """Convert a Python integer or long integer pylong to a C void pointer.
     If pylong cannot be converted, an OverflowError will be raised.  This
     is only assured to produce a usable void pointer for values created
     with PyLong_FromVoidPtr().
     For values outside 0..LONG_MAX, both signed and unsigned integers are accepted."""
-    return rffi.cast(rffi.VOIDP_real, space.uint_w(w_long))
+    return rffi.cast(rffi.VOIDP, space.uint_w(w_long))
 
 @cpython_api([PyObject], rffi.SIZE_T, error=-1)
 def _PyLong_NumBits(space, w_long):


More information about the Pypy-commit mailing list