[Python-checkins] python/dist/src/Lib/test test_minidom.py, 1.39.4.2, 1.39.4.3

nnorwitz@users.sourceforge.net nnorwitz at users.sourceforge.net
Fri Sep 30 06:58:26 CEST 2005


Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12823/Lib/test

Modified Files:
      Tag: release24-maint
	test_minidom.py 
Log Message:
- Patch #1309009, Fix segfault in pyexpat when the XML document is in latin_1,
  but Python incorrectly assumes it is in UTF-8 format


Index: test_minidom.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_minidom.py,v
retrieving revision 1.39.4.2
retrieving revision 1.39.4.3
diff -u -d -r1.39.4.2 -r1.39.4.3
--- test_minidom.py	25 Aug 2005 22:14:21 -0000	1.39.4.2
+++ test_minidom.py	30 Sep 2005 04:58:23 -0000	1.39.4.3
@@ -889,6 +889,15 @@
             and doc.toxml('utf-8') == '<?xml version="1.0" encoding="utf-8"?><foo>\xe2\x82\xac</foo>'
             and doc.toxml('iso-8859-15') == '<?xml version="1.0" encoding="iso-8859-15"?><foo>\xa4</foo>',
             "testEncodings - encoding EURO SIGN")
+
+    # Verify that character decoding errors throw exceptions instead of crashing
+    try:
+        doc = parseString('<fran\xe7ais>Comment \xe7a va ? Tr\xe8s bien ?</fran\xe7ais>')
+    except UnicodeDecodeError:
+        pass
+    else:
+        print 'parsing with bad encoding should raise a UnicodeDecodeError'
+
     doc.unlink()
 
 class UserDataHandler:



More information about the Python-checkins mailing list