[Python-Dev] xml issue in 2.5

"Martin v. Löwis" martin at v.loewis.de
Mon Jul 10 08:09:22 CEST 2006


Neal Norwitz wrote:
> http://python.org/sf/1513611
> xml.sax.ParseException weirdness in python 2.5b1.  The following code
> doesn't work:
> 
> from xml.sax import make_parser, SAXParseException
> 
> parser = make_parser()
> try:
>    parser.parse(StringIO('invalid'))
> except SAXParseException:
>    print 'caught it!'
> 
> Any comments?

The problem can be simplified to this:

py> import xml.sax,xmlcore.sax,sys
py> sys.modules['xml.sax'] is sys.modules['xmlcore.sax']
False

One way to fix this would be to never refer to "xmlcore"
explicitly (i.e. import from xml.sax._exceptions in
expatreader), but I guess that would defeat the purpose
of the xmlcore renaming.

Regards,
Martin


More information about the Python-Dev mailing list