2012/4/4 Stefan Behnel <[email protected]>:
> I consider it a rather special case that Cython subtypes PyCFunction_Type,
> so a general solution may not be necessary. Is there anything we can do on
> Cython side? We control the type and its tp_call slot, after all. You could
> also implement a fake PyCFunction_Call function specifically for this
> purpose. Or even just a PyPyCFunction_Call().

Yes, this is the hack I was referring to in another thread:
cpyext could implement PyCFunction_Call by not taking a w_obj as argument
(this would require building an interpreter object from its address,
which would not work
because there is already a CyFunction pointer at the same address)
but work directly with the PyCFunctionObject members (m_ml, m_self and m_module)
without considering they come from a PyObject-derived structure.

But this approach is not scalable - it has to be hand-written each time,
and will not work at all for most kind of objects.

-- 
Amaury Forgeot d'Arc
_______________________________________________
pypy-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-dev

Reply via email to