[XML-SIG] Does this code segfault for you? (original) (raw)

Dave dwallace23@comcast.com
Fri, 05 Apr 2002 22:27:11 -0500


The following code (painstakingly adapted from a similar pattern used in ZSI) causes a segfault with PyXML built from cvs HEAD & v070 but seems to run ok with v066 and earlier. This is with Python 2.2.1rc2 on Linux. (I tested also with Python 1.5 w/ PyXML 0.5.2, it worked there with no problems)

Does anyone else get similar results?

Dave.

--------------------------------------cut here-------------------------------------------------------------------- ''' if "IN_BAD" is parsed, a segfault is triggered at exit. This appears to be a result of further cleanup code running after the unicode object stuff has been freed by Python '''

IN_BAD=''' <a:x xmlns:a="uri:testing"> '''

IN_OK=''' <a:x xmlns:a="uri:testing"> '''

Change this to IN_BAD to get a segfault

No problems occur with IN_OK

#IN = IN_OK IN = IN_BAD

from xml.dom.ext.reader import PyExpat

class Reader: def init(self,reader): self.reader = reader

def __del__(self):
    print "cleaning"
    # This triggers the segfault
    self.reader.releaseNode(self.d)

r = Reader(PyExpat.Reader()) r.d=r.reader.fromString(IN)

print "done"