Re: [Cython] Surprising behaviour wrt. generated tp_clear and tp_dealloc functions

2013-08-01 Thread Torsten Landschoff
Hi again, On 07/14/2013 10:39 AM, Stefan Behnel wrote: > Torsten Landschoff, 11.07.2013 00:10: >> I attached my current (trivial) patch. Currently I only support a decorator >> >> @cython.noclear >> cdef class ... >> >> to inhibit generation of tp_clear. > Thanks, looks ok to me. Please op

Re: [Cython] Surprising behaviour wrt. generated tp_clear and tp_dealloc functions

2013-07-16 Thread Torsten Landschoff
Hi Stefan, On 07/14/2013 10:39 AM, Stefan Behnel wrote: > Torsten Landschoff, 11.07.2013 00:10: >> I attached my current (trivial) patch. Currently I only support a decorator >> >> @cython.noclear >> cdef class ... >> >> to inhibit generation of tp_clear. > Thanks, looks ok to me. Please o

Re: [Cython] Surprising behaviour wrt. generated tp_clear and tp_dealloc functions

2013-07-14 Thread Stefan Behnel
Torsten Landschoff, 11.07.2013 00:10: > I attached my current (trivial) patch. Currently I only support a decorator > > @cython.noclear > cdef class ... > > to inhibit generation of tp_clear. Thanks, looks ok to me. Please open a pull request on github for it. > Before I continue with

Re: [Cython] Surprising behaviour wrt. generated tp_clear and tp_dealloc functions

2013-07-10 Thread Torsten Landschoff
Hi Stefan, sorry for the delay, I was in the US for parental leave. I had hoped to find some time to work on the promised patch over there, but I fell short. On 04/22/2013 02:28 PM, Stefan Behnel wrote: > Please do. Just ask back on this list if there's anything that's not > clear to you. I attac

Re: [Cython] Surprising behaviour wrt. generated tp_clear and tp_dealloc functions

2013-04-23 Thread Stefan Behnel
Torsten Landschoff, 23.04.2013 10:06: > On 04/23/2013 08:01 AM, Stefan Behnel wrote: >> Greg Ewing, 23.04.2013 01:16: >>> Only if subclassing of Slot and Context are forbidden. >> Right. Subtypes of a non-GC type can happily add attributes and start >> supporting cyclic garbage collection, includin

Re: [Cython] Surprising behaviour wrt. generated tp_clear and tp_dealloc functions

2013-04-23 Thread Torsten Landschoff
On 04/23/2013 08:01 AM, Stefan Behnel wrote: > Greg Ewing, 23.04.2013 01:16: >> Only if subclassing of Slot and Context are forbidden. > Right. Subtypes of a non-GC type can happily add attributes and start > supporting cyclic garbage collection, including Python subclasses. So this > only applies

Re: [Cython] Surprising behaviour wrt. generated tp_clear and tp_dealloc functions

2013-04-22 Thread Stefan Behnel
Greg Ewing, 23.04.2013 01:16: > Stefan Behnel wrote: >> Torsten Landschoff, 22.04.2013 13:07: >>> One could even think about building a graph of possible object >>> relationships ... Slot refers only to Slots and Slots only to Context, so >>> these can't build a cycle. >> >> Interesting. Yes, that

Re: [Cython] Surprising behaviour wrt. generated tp_clear and tp_dealloc functions

2013-04-22 Thread Greg Ewing
Stefan Behnel wrote: Torsten Landschoff, 22.04.2013 13:07: One could even think about building a graph of possible object relationships ... Slot refers only to Slots and Slots only to Context, so these can't build a cycle. Interesting. Yes, that might work. Only if subclassing of Slot and

Re: [Cython] Surprising behaviour wrt. generated tp_clear and tp_dealloc functions

2013-04-22 Thread Stefan Behnel
Torsten Landschoff, 22.04.2013 13:56: > On 04/22/2013 01:50 PM, Stefan Behnel wrote: >>> a good idea would be to warn if __dealloc__ actually references a >>> Python attribute that tp_clear could have cleared, with a pointer to the >>> class decorator that exempts the attribute/instance from tp_cle

Re: [Cython] Surprising behaviour wrt. generated tp_clear and tp_dealloc functions

2013-04-22 Thread Torsten Landschoff
Hi Stefan, On 04/22/2013 01:50 PM, Stefan Behnel wrote: > Exactly - an extremely special case. It's an inherent property of the > Cython language that user visible references are never NULL. (minus > evil C code, obviously.) Suits me. >> a good idea would be to warn if __dealloc__ actually refere

Re: [Cython] Surprising behaviour wrt. generated tp_clear and tp_dealloc functions

2013-04-22 Thread Stefan Behnel
Torsten Landschoff, 22.04.2013 13:07: > On 04/22/2013 07:31 AM, Stefan Behnel wrote: >>> But this did not give me the crucial hint: Currently, any references to >>> Python objects *may* be invalid at the time dealloc is called. This is >>> because Cython generates a tp_clear function for each exten

Re: [Cython] Surprising behaviour wrt. generated tp_clear and tp_dealloc functions

2013-04-22 Thread Torsten Landschoff
Hi Stefan, thank you for your extremely quick reply! On 04/22/2013 07:31 AM, Stefan Behnel wrote: >> But this did not give me the crucial hint: Currently, any references to >> Python objects *may* be invalid at the time dealloc is called. This is >> because Cython generates a tp_clear function fo

Re: [Cython] Surprising behaviour wrt. generated tp_clear and tp_dealloc functions

2013-04-21 Thread Stefan Behnel
Hi, Torsten Landschoff, 21.04.2013 23:57: > I am using Cython to generate a trivial wrapper for a small subset of > the (already small) interface of libp11 (see > https://github.com/OpenSC/libp11 for information about libp11). I know a > bit about Python extension modules and just wanted to avoid