[pypy-svn] r74949 - in pypy/trunk/pypy/module/cpyext: . include
afa at codespeak.net
afa at codespeak.net
Mon May 31 01:40:04 CEST 2010
Author: afa
Date: Mon May 31 01:40:02 2010
New Revision: 74949
Modified:
pypy/trunk/pypy/module/cpyext/include/object.h
pypy/trunk/pypy/module/cpyext/object.py
Log:
Reduce C compilation warnings:
- a macro will accept all types that extend PyObject
- PyObject_GC_Track actually accept void*.
Modified: pypy/trunk/pypy/module/cpyext/include/object.h
==============================================================================
--- pypy/trunk/pypy/module/cpyext/include/object.h (original)
+++ pypy/trunk/pypy/module/cpyext/include/object.h Mon May 31 01:40:02 2010
@@ -475,6 +475,9 @@
} \
} while (0)
+#define PyObject_TypeCheck(ob, tp) \
+ ((ob)->ob_type == (tp) || PyType_IsSubtype((ob)->ob_type, (tp)))
+
/* Copied from CPython ----------------------------- */
int PyObject_AsReadBuffer(PyObject *, const void **, Py_ssize_t *);
int PyObject_AsWriteBuffer(PyObject *, void **, Py_ssize_t *);
Modified: pypy/trunk/pypy/module/cpyext/object.py
==============================================================================
--- pypy/trunk/pypy/module/cpyext/object.py (original)
+++ pypy/trunk/pypy/module/cpyext/object.py Mon May 31 01:40:02 2010
@@ -61,7 +61,7 @@
def PyObject_GC_Del(space, obj):
PyObject_Del(space, obj)
- at cpython_api([PyObject], lltype.Void)
+ at cpython_api([rffi.VOIDP_real], 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
@@ -70,7 +70,7 @@
end of the constructor."""
pass
- at cpython_api([rffi.VOIDP], lltype.Void)
+ at cpython_api([rffi.VOIDP_real], 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
@@ -284,16 +284,6 @@
w_res = PyObject_RichCompare(space, ref1, ref2, opid)
return int(space.is_true(w_res))
- at cpython_api([PyObject, PyObject], rffi.INT_real, error=CANNOT_FAIL)
-def PyObject_TypeCheck(space, w_obj, w_type):
- """Return true if the object o is of type type or a subtype of type. Both
- parameters must be non-NULL.
- """
- w_obj_type = space.type(w_obj)
- assert isinstance(w_type, W_TypeObject)
- return int(space.is_w(w_obj_type, w_type) or
- space.is_true(space.issubtype(w_obj_type, w_type)))
-
@cpython_api([PyObject], PyObject)
def PyObject_SelfIter(space, ref):
"""Undocumented function, this is wat CPython does."""
More information about the Pypy-commit
mailing list