View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006563ITKpublic2008-03-07 13:022010-11-24 10:52
ReporterMario Ceresa 
Assigned ToGaetan Lehmann 
PrioritynormalSeveritycrashReproducibilityalways
StatusassignedResolutionopen 
PlatformAMD 64 - Intel Xeon 64OSFedora LinuxOS Version8
Product Version 
Target VersionFixed in Version 
Summary0006563: WrapITK corrupts python interpreter
DescriptionThe python interpreter dies with the following error:

python: Objects/stringobject.c:107: PyString_FromString: Assertion
`str != ((void *)0)' failed.
Aborted

whenever I run the following code:
-----------------------------------------------------------------
from xml.dom.ext.reader import Sax2
import itk

im = itk.ImageFileReader.IUS2.New()

reader = Sax2.Reader()
-----------------------------------------------------------------

it doesn't happen if i don't create the ImageFileReader filter. I suppose because the import is lazy and it doesn't actually load c++ code until I try and use a class.
Steps To ReproduceBuild and install ITK + WrapITK + this patch http://voxel.jouy.inra.fr/darcs/contrib-itk/WrapITK/patch/optional/python-interface-patches.patch [^]

Install PyXML 0.8.4.7

fire up a python interpreter and write:

from xml.dom.ext.reader import Sax2
import itk

im = itk.ImageFileReader.IUS2.New()

reader = Sax2.Reader()

the interpreted crashes.
Tagspython, WrapITK
Resolution Date
Sprint
Sprint Status
Attached Files

 Relationships

  Notes
(0010751)
Mario Ceresa (reporter)
2008-03-07 13:18

It happens the same with the 4suite package for xml processing http://4suite.org [^] :

import itk

itk.ImageFileReader.IUS2.New()

from Ft.Xml import Parse

python: Objects/stringobject.c:107: PyString_FromString: Assertion `str != ((void *)0)' failed.
Aborted

Now I'll try and search where exactly the problem lies and if there are other packages affected too
(0016762)
Gaetan Lehmann (developer)
2009-06-26 13:54

I've reproduced the problem, both with wrapitk stable and unstable.

Running your test program with gdb, we get the folowing backtrace:

#1 0x00007f5e0050312b in PyString_FromString (str=0x0) at Objects/stringobject.c:116
0000002 0x00007f5e00567ac1 in PyModule_AddStringConstant (m=0x25fb088, name=0x7f5df5db3f08 "XML_ERROR_ENTITY_DECLARED_IN_PE", value=0x0) at Python/modsupport.c:636
0000003 0x00007f5df5db2fb7 in initpyexpat () at extensions/pyexpat.c:1973
0000004 0x00007f5e00564a46 in _PyImport_LoadDynamicModule (name=0x7fff08a26660 "xml.parsers.pyexpat",
    pathname=0x7fff08a25590 "/usr/lib64/python2.6/site-packages/_xmlplus/parsers/pyexpat.so", fp=<value optimized out>) at Python/importdl.c:53


Googling a bit about pyexpat.c:1973 and XML_ERROR_ENTITY_DECLARED_IN_PE, I found http://archive.netbsd.se/?ml=python-bugs-list&a=2006-09&t=2344872 [^] wich leaded me to http://bugs.python.org/issue1295808 [^] which explains that the problem might be due to the use of different versions of expat.

The expat version in ITK is quite old (1.95.2), and doesn't event the symbol XML_ERROR_ENTITY_DECLARED_IN_PE. A possible fix would be to update expat in ITK.
A better fix would be able build ITK with the expat installed on the system and, hopefully, used by python.

But I can't find such build option in ITK. I'll talk about that on the developer mailing list.

Thanks for the report!
(0023531)
Gaetan Lehmann (developer)
2010-11-24 10:52

a real bug still to be fixed - don't close

 Issue History
Date Modified Username Field Change
2008-03-07 13:02 Mario Ceresa New Issue
2008-03-07 13:11 Mario Ceresa Tag Attached: WrapITK
2008-03-07 13:11 Mario Ceresa Tag Attached: python
2008-03-07 13:18 Mario Ceresa Note Added: 0010751
2009-05-17 16:12 Gaetan Lehmann Status new => assigned
2009-05-17 16:12 Gaetan Lehmann Assigned To => Gaetan Lehmann
2009-06-26 13:54 Gaetan Lehmann Note Added: 0016762
2010-11-24 10:52 Gaetan Lehmann Note Added: 0023531


Copyright © 2000 - 2018 MantisBT Team