On Mon, Feb 14, 2011 at 1:49 AM, Greg Ewing <greg.ew...@canterbury.ac.nz>wrote:

> Chris Colbert wrote:
>
>> The problem with delattr (and thus PyObject_DelAttr) arises when you
>> define a __delattr__ method on your class. There is not easy way to then
>> call back into the "normal" python delattr semantics, except by doing
>> object.__delattr__ (which is not optimized by Cython).
>>
>
> Hmmm, perhaps it should be? And similarly for all the other type
> slots.
>
>
>  I would argue that there should be at least some way to pass a NULL
>> pointer in Cython where a PyObject* is expected.
>>
>
> The trouble is that supporting this in general both safely and
> efficiently would require keeping track of which object references
> are allowed to be NULL. Could be done, but might require quite a
> lot of work.
>
> Maybe something more limited could be done such as allowing
> a literal NULL to be passed to a function argument that is
> specially marked as permitting this.
>
>
I had the same kind of thoughts. Perhaps something like:

cdef extern from "Python.h":
    PyObject_GenericSetAttr(object, object, object or NULL)
_______________________________________________
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel

Reply via email to