[pypy-commit] pypy default: Export PyDescr_NewMethod and the PyWrapperDescr_Type it returns
amauryfa
noreply at buildbot.pypy.org
Sun Nov 6 20:59:25 CET 2011
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch:
Changeset: r48847:8ee82fc7f024
Date: 2011-10-27 01:13 +0200
http://bitbucket.org/pypy/pypy/changeset/8ee82fc7f024/
Log: Export PyDescr_NewMethod and the PyWrapperDescr_Type it returns
diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -392,6 +392,7 @@
'Slice': 'space.gettypeobject(W_SliceObject.typedef)',
'StaticMethod': 'space.gettypeobject(StaticMethod.typedef)',
'CFunction': 'space.gettypeobject(cpyext.methodobject.W_PyCFunctionObject.typedef)',
+ 'WrapperDescr': 'space.gettypeobject(cpyext.methodobject.W_PyCMethodObject.typedef)'
}.items():
GLOBALS['Py%s_Type#' % (cpyname, )] = ('PyTypeObject*', pypyexpr)
diff --git a/pypy/module/cpyext/methodobject.py b/pypy/module/cpyext/methodobject.py
--- a/pypy/module/cpyext/methodobject.py
+++ b/pypy/module/cpyext/methodobject.py
@@ -240,6 +240,7 @@
def PyStaticMethod_New(space, w_func):
return space.wrap(StaticMethod(w_func))
+ at cpython_api([PyObject, lltype.Ptr(PyMethodDef)], PyObject)
def PyDescr_NewMethod(space, w_type, method):
return space.wrap(W_PyCMethodObject(space, method, w_type))
diff --git a/pypy/module/cpyext/test/test_methodobject.py b/pypy/module/cpyext/test/test_methodobject.py
--- a/pypy/module/cpyext/test/test_methodobject.py
+++ b/pypy/module/cpyext/test/test_methodobject.py
@@ -79,7 +79,7 @@
raises(TypeError, mod.isSameFunction, 1)
class TestPyCMethodObject(BaseApiTest):
- def test_repr(self, space):
+ def test_repr(self, space, api):
"""
W_PyCMethodObject has a repr string which describes it as a method
and gives its name and the name of its class.
@@ -94,7 +94,7 @@
ml.c_ml_meth = rffi.cast(PyCFunction_typedef,
c_func.get_llhelper(space))
- method = PyDescr_NewMethod(space, space.w_str, ml)
+ method = api.PyDescr_NewMethod(space.w_str, ml)
assert repr(method).startswith(
"<built-in method 'func' of 'str' object ")
More information about the pypy-commit
mailing list