Author: Ronan Lamy <[email protected]>
Branch:
Changeset: r89003:25da7bc97194
Date: 2016-12-10 17:36 +0000
http://bitbucket.org/pypy/pypy/changeset/25da7bc97194/
Log: More simplification using llslot()
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
@@ -25,9 +25,9 @@
basestruct = PyObject.TO
W_BaseObject = W_ObjectObject
- def get_dealloc(self, space):
+ def get_dealloc(self):
from pypy.module.cpyext.typeobject import subtype_dealloc
- return subtype_dealloc.api_func.get_llhelper(space)
+ return subtype_dealloc
def allocate(self, space, w_type, itemcount=0):
# similar to PyType_GenericAlloc?
@@ -107,8 +107,8 @@
return tp_alloc(space, w_type, itemcount)
if tp_dealloc:
- def get_dealloc(self, space):
- return tp_dealloc.api_func.get_llhelper(space)
+ def get_dealloc(self):
+ return tp_dealloc
if tp_attach:
def attach(self, space, pyobj, w_obj):
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
@@ -652,7 +652,7 @@
# richcmpfunc(s)
return
- return lambda: llslot(space, slot_func)
+ return slot_func
PyWrapperFlag_KEYWORDS = 1
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
@@ -253,20 +253,14 @@
# XXX special case iternext
continue
- slot_func_helper = None
-
if slot_func is None and typedef is not None:
- get_slot = get_slot_tp_function(space, typedef, slot_name)
- if get_slot:
- slot_func_helper = get_slot()
- elif slot_func:
- slot_func_helper = llslot(space, slot_func)
-
- if slot_func_helper is None:
+ slot_func = get_slot_tp_function(space, typedef, slot_name)
+ if not slot_func:
if WARN_ABOUT_MISSING_SLOT_FUNCTIONS:
os.write(2, "%s defined by %s but no slot function defined!\n"
% (
method_name, w_type.getname(space)))
continue
+ slot_func_helper = llslot(space, slot_func)
# XXX special case wrapper-functions and use a "specific" slot func
@@ -683,7 +677,7 @@
# dealloc
if space.gettypeobject(w_type.layout.typedef) is w_type:
# only for the exact type, like 'space.w_tuple' or 'space.w_list'
- pto.c_tp_dealloc = typedescr.get_dealloc(space)
+ pto.c_tp_dealloc = llslot(space, typedescr.get_dealloc())
else:
# for all subtypes, use subtype_dealloc()
pto.c_tp_dealloc = llslot(space, subtype_dealloc)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit