On Mon, Feb 14, 2011 at 1:49 AM, Greg Ewing 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
>
On Mon, Feb 14, 2011 at 1:50 AM, Greg Ewing wrote:
> Chris Colbert wrote:
>
>> changing the include definition to:
>>
>> cdef extern from "Python.h":
>> int PyObject_GenericSetAttr(PyObject*, PyObject*, PyObject*) except -1
>>
>
> This suggests another possible workaround:
>
>
> cdef extern f
Chris Colbert wrote:
changing the include definition to:
cdef extern from "Python.h":
int PyObject_GenericSetAttr(PyObject*, PyObject*, PyObject*) except -1
This suggests another possible workaround:
cdef extern from "Python.h":
int PyObject_GenericDelAttr "PyObject_GenericSetAttr"
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
changing the include definition to:
cdef extern from "Python.h":
int PyObject_GenericSetAttr(PyObject*, PyObject*, PyObject*) except -1
Seems to solve the problem, with the inconvenience of needing to explicitly
cast to before calling it. However, the objects are no longer
incref'd before c
I should mention, that these PyObject_Generic* functions are being used from
with __getattribute__, __setattr__, and __delattr__ methods. I should have
added that context in the begining.
On Sun, Feb 13, 2011 at 3:37 PM, Chris Colbert wrote:
> The problem with delattr (and thus PyObject_DelAttr)
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).
Futher, calling PyObject_Generi
Chris Colbert wrote:
I have cython file which is using PyObject_GenericSetAttr
Now in my script I am using that function to generically delete an
attribute by passing a NULL as the last value (this is proper way to
trigger a generic delattr in the Python c-api)
I would have thought the prope
I have cython file which is using PyObject_GenericSetAttr which is defined
as follows in my pyx file:
cdef extern from "Python.h":
int PyObject_GenericSetAttr(object, object, object) except -1
Now in my script I am using that function to generically delete an attribute
by passing a NULL as t