[pypy-commit] pypy cpyext-fast-typecheck: convert wrap_objobjproc to the new style
antocuni
pypy.commits at gmail.com
Thu Mar 22 13:03:06 EDT 2018
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: cpyext-fast-typecheck
Changeset: r94084:0e0dc6fb5d4c
Date: 2018-03-22 17:08 +0100
http://bitbucket.org/pypy/pypy/changeset/0e0dc6fb5d4c/
Log: convert wrap_objobjproc to the new style
diff --git a/pypy/module/cpyext/slotdefs.py b/pypy/module/cpyext/slotdefs.py
--- a/pypy/module/cpyext/slotdefs.py
+++ b/pypy/module/cpyext/slotdefs.py
@@ -271,15 +271,17 @@
space.fromcache(State).check_and_raise_exception(always=True)
# Warning, confusing function name (like CPython). Used only for sq_contains.
-def wrap_objobjproc(space, w_self, w_args, func):
- func_target = rffi.cast(objobjproc, func)
- check_num_args(space, w_args, 1)
- w_value, = space.fixedview(w_args)
- res = generic_cpy_call(space, func_target, w_self, w_value)
- res = rffi.cast(lltype.Signed, res)
- if res == -1:
- space.fromcache(State).check_and_raise_exception(always=True)
- return space.newbool(bool(res))
+class W_WrapObjObjProc(W_PyCWrapperObject):
+ def call(self, space, w_self, __args__):
+ self.check_args(__args__, 1)
+ func = self.get_func_to_call()
+ func_target = rffi.cast(objobjproc, func)
+ w_value = __args__.arguments_w[0]
+ res = generic_cpy_call(space, func_target, w_self, w_value)
+ res = rffi.cast(lltype.Signed, res)
+ if res == -1:
+ space.fromcache(State).check_and_raise_exception(always=True)
+ return space.newbool(bool(res))
def wrap_objobjargproc(space, w_self, w_args, func):
func_target = rffi.cast(objobjargproc, func)
@@ -945,7 +947,7 @@
"x.__delslice__(i, j) <==> del x[i:j]\n\
\n\
Use of negative indices is not supported."),
- SQSLOT("__contains__", sq_contains, slot_sq_contains, wrap_objobjproc,
+ SQSLOT("__contains__", sq_contains, slot_sq_contains, W_WrapObjObjProc,
"x.__contains__(y) <==> y in x"),
SQSLOT("__iadd__", sq_inplace_concat, NULL,
W_WrapBinaryFunc, "x.__iadd__(y) <==> x+=y"),
More information about the pypy-commit
mailing list