[pypy-svn] r74519 - pypy/trunk/pypy/module/cpyext
afa at codespeak.net
afa at codespeak.net
Sun May 16 22:57:19 CEST 2010
Author: afa
Date: Sun May 16 22:57:18 2010
New Revision: 74519
Modified:
pypy/trunk/pypy/module/cpyext/pyobject.py
pypy/trunk/pypy/module/cpyext/typeobject.py
Log:
use get_llhelper() whenever possible,
this may fix translation because this function uses a memo
(got duplicate definitions for PyObject_dealloc)
Modified: pypy/trunk/pypy/module/cpyext/pyobject.py
==============================================================================
--- pypy/trunk/pypy/module/cpyext/pyobject.py (original)
+++ pypy/trunk/pypy/module/cpyext/pyobject.py Sun May 16 22:57:18 2010
@@ -56,9 +56,7 @@
realize = tp_realize
def get_dealloc(self, space):
- return llhelper(
- tp_dealloc.api_func.functype,
- tp_dealloc.api_func.get_wrapper(space))
+ return tp_dealloc.api_func.get_llhelper(space)
def allocate(self, space, w_type, itemcount=0):
# similar to PyType_GenericAlloc?
Modified: pypy/trunk/pypy/module/cpyext/typeobject.py
==============================================================================
--- pypy/trunk/pypy/module/cpyext/typeobject.py (original)
+++ pypy/trunk/pypy/module/cpyext/typeobject.py Sun May 16 22:57:18 2010
@@ -115,8 +115,7 @@
if WARN_ABOUT_MISSING_SLOT_FUNCTIONS:
os.write(2, method_name + " defined by the type but no slot function defined!\n")
continue
- slot_func_helper = llhelper(slot_func.api_func.functype,
- slot_func.api_func.get_wrapper(space))
+ slot_func_helper = slot_func.api_func.get_llhelper(space)
# XXX special case wrapper-functions and use a "specific" slot func
# the special case of __new__ in CPython works a bit differently, hopefully
@@ -191,8 +190,7 @@
def setup_new_method_def(space):
ptr = get_new_method_def(space)
ptr.c_ml_meth = rffi.cast(PyCFunction,
- llhelper(tp_new_wrapper.api_func.functype,
- tp_new_wrapper.api_func.get_wrapper(space)))
+ tp_new_wrapper.api_func.get_llhelper(space))
def add_tp_new_wrapper(space, dict_w, pto):
if "__new__" in dict_w:
@@ -408,8 +406,7 @@
def subtype_dealloc(space, obj):
pto = obj.c_ob_type
base = pto
- this_func_ptr = llhelper(subtype_dealloc.api_func.functype,
- subtype_dealloc.api_func.get_wrapper(space))
+ this_func_ptr = subtype_dealloc.api_func.get_llhelper(space)
while base.c_tp_dealloc == this_func_ptr:
base = base.c_tp_base
assert base
@@ -453,10 +450,8 @@
def setup_string_buffer_procs(space, pto):
c_buf = lltype.malloc(PyBufferProcs, flavor='raw', zero=True)
- c_buf.c_bf_getsegcount = llhelper(str_segcount.api_func.functype,
- str_segcount.api_func.get_wrapper(space))
- c_buf.c_bf_getreadbuffer = llhelper(str_getreadbuffer.api_func.functype,
- str_getreadbuffer.api_func.get_wrapper(space))
+ c_buf.c_bf_getsegcount = str_segcount.api_func.get_llhelper(space)
+ c_buf.c_bf_getreadbuffer = str_getreadbuffer.api_func.get_llhelper(space)
pto.c_tp_as_buffer = c_buf
def type_dealloc(space, obj):
@@ -496,10 +491,8 @@
setup_string_buffer_procs(space, pto)
pto.c_tp_flags = Py_TPFLAGS_HEAPTYPE
- pto.c_tp_free = llhelper(PyObject_Del.api_func.functype,
- PyObject_Del.api_func.get_wrapper(space))
- pto.c_tp_alloc = llhelper(PyType_GenericAlloc.api_func.functype,
- PyType_GenericAlloc.api_func.get_wrapper(space))
+ pto.c_tp_free = PyObject_Del.api_func.get_llhelper(space)
+ pto.c_tp_alloc = PyType_GenericAlloc.api_func.get_llhelper(space)
pto.c_tp_name = rffi.str2charp(w_type.getname(space, "?"))
pto.c_tp_basicsize = -1 # hopefully this makes malloc bail out
pto.c_tp_itemsize = 0
More information about the Pypy-commit
mailing list