]> granicus.if.org Git - python/commitdiff
Issue #12451: xml.dom.pulldom: parse() now opens files in binary mode instead
authorVictor Stinner <victor.stinner@haypocalc.com>
Sun, 3 Jul 2011 23:25:55 +0000 (01:25 +0200)
committerVictor Stinner <victor.stinner@haypocalc.com>
Sun, 3 Jul 2011 23:25:55 +0000 (01:25 +0200)
of the text mode (using the locale encoding) to avoid encoding issues.

Lib/xml/dom/pulldom.py
Misc/NEWS

index 81a36b073e8ec6259dcaf26637bb624c6847b024..d5ac8b2b9847b3b1e839942bfa864330f1a1d502 100644 (file)
@@ -326,7 +326,7 @@ def parse(stream_or_string, parser=None, bufsize=None):
     if bufsize is None:
         bufsize = default_bufsize
     if isinstance(stream_or_string, str):
-        stream = open(stream_or_string)
+        stream = open(stream_or_string, 'rb')
     else:
         stream = stream_or_string
     if not parser:
index 250acc2913e9e935ab0eb1b84f95a81d1b3dbe73..1d7669888f451c8d76defaa5a4c14bdf8ba47be6 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -19,6 +19,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #12451: xml.dom.pulldom: parse() now opens files in binary mode instead
+  of the text mode (using the locale encoding) to avoid encoding issues.
+
 C-API
 -----