[Python-checkins] cpython (merge 3.2 -> default): (merge 3.2) Issue #12451: xml.dom.pulldom: parse() now opens files in binary

victor.stinner python-checkins at python.org
Mon Jul 4 01:29:13 CEST 2011


http://hg.python.org/cpython/rev/c039c6b58907
changeset:   71163:c039c6b58907
parent:      71161:36df19f9e94b
parent:      71162:81424281ee59
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Mon Jul 04 01:27:37 2011 +0200
summary:
  (merge 3.2) 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.

files:
  Lib/xml/dom/pulldom.py |  2 +-
  Misc/NEWS              |  3 +++
  2 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Lib/xml/dom/pulldom.py b/Lib/xml/dom/pulldom.py
--- a/Lib/xml/dom/pulldom.py
+++ b/Lib/xml/dom/pulldom.py
@@ -326,7 +326,7 @@
     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:
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -209,6 +209,9 @@
 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.
+
 - Issue #12147: Adjust the new-in-3.2 smtplib.send_message method for better
   conformance to the RFCs:  correctly handle Sender and Resent- headers.
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list