On Feb 17, 10:35 pm, Nils Bruin <nbr...@sfu.ca> wrote:
> The only reason I can think of for inheritance not to pick up on the
> changed tp_hash field is that PyType_Ready gets called on the data
> structure formed for MyHash before we get a chance to change the
> tp_hash field.

Indeed, PyType_Ready calls add_operators, which adds method wrappers
around the provided slot routines to the type's tp_dict. So you need
to make sure your slots are properly set before you call PyType_Ready.

If you feel really hacky, you could remove the relevant entries from
type->tp_dict and rerun add_operators on it ...

What this suggests is that cython should really accept "cdef" or
perhaps "cpdef" methods for certain (most?) slots, with the right
signature. I think these examples show there are real applications for
providing (optimized) cdef methods for slots. Especially because
python's PyType_Ready will wrap them anyway!

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to