[pypy-dev] special methods

Armin Rigo arigo at tunes.org
Fri Mar 30 18:25:35 CEST 2007


Hi Simon,

On Thu, Mar 29, 2007 at 06:37:44PM -0700, Simon Burton wrote:
> I am very curious about this suggestively named hlinvoke.. It seems that
> if we can get the ll_str of rclass to call the low-level-ized version of the __str__
> method then we are done. Is this the idea behind hlinvoke ? (... looking now at test_rpbc...)

Yes.  It's used to call back RPython functions from low-level helpers,
where it's normally not possible.  It's used by objectmodel.rdict() to
call the RPython functions that implement the custom key equality and
hash.  See lltypesystem/rdict.py for an example...

You don't get method dispatch for free - you have to call an RPython
function, not a method, so you'd need to manually add in the vtable of
the class a field for the low-level function pointer to the RPython
function.  Note also that hlinvoke() is not yet implemented for the
ootypesystem.


A bientot,

Armin.



More information about the Pypy-dev mailing list