A plea for a bugfix was Re: [Pyrex] Unlucky fellow needs help (pyrex
crashes)
Helmut Jarausch
jarausch at skynet.be
Wed Mar 8 12:16:49 CET 2006
It would be very kind if someone could help me
in fixing Pyrex 0.9.3 (.1)
I could benefit quite a lot from subclassing.
But my base class __new__ takes only self as
argument whereas my derived classes take more
parameters.
So, I again stumbled on the bug below.
I've never looked at Pyrex source before
but I probably need to.
Can anybody help a bit where this bug
can be fixed?
The problem has nothing to do with a forward
declaration as in the original example
Just try
cdef class B:
cdef int Seen
def __new__(self):
self.Seen=17
cdef class D(B):
def __new__(self,int DS):
self.Seen= DS
def showme(self):
print self.Seen
# ===================================================
# from CES import D
# X=D(13)
# X.showme()
Is there a debug mode for Pyrex itself?
Many thanks,
Helmut.
On 23 Feb, Lenard Lindstrom wrote:
> On 23 Feb 2006 at 17:25, Greg Ewing wrote:
>
>> Helmut Jarausch wrote:
>>
>> > cdef class ITNO # forward declaration
>> >
>> > cdef class ITNO_List(ITNO):
>> > cdef int cnt
>> > cdef int From
>> > cdef int To
>>
>> This is an error, since I never intended to support
>> using a class as a base class prior to its definition.
>> It's a bug that Pyrex crashes instead of reporting the
>> error, though.
>>
>> > Variant II is accepted by pyrexc but
>> > gives a segment fault while running the loop
>> >
>> > cdef class ITNO # forward declaration
>> > cdef class ITNO_List(ITNO) # forward declaration
>>
>> I'm not sure whether this should be allowed or not.
>> I'll look into these.
>>
>> Thanks,
>>
> The problem is that the ITNO __new__ takes no arguments while the
> ITNO_List __new__ takes two. When creating a new ITNO_List instance
> the INTO __new__ function is called with the wrong number of
> arguments and raises an exception.
>
> The segment fault is because Pyrex is not checking if ITNO.__new__
> has raised an exception so calls INTO_List.__new__ with an invalid
> object. Pyrex generated tp_new slot functions do not test if the
> pointer to the newly allocated object is NULL.
>
> Lenard Lindstrom
> <len-l at telus.net>
>
>
> _______________________________________________
> Pyrex mailing list
> Pyrex at lists.copyleft.no
> http://lists.copyleft.no/mailman/listinfo/pyrex
>
--
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany
More information about the Pyrex
mailing list