From: Victor Stinner Date: Sun, 3 Jul 2011 23:25:55 +0000 (+0200) Subject: Issue #12451: xml.dom.pulldom: parse() now opens files in binary mode instead X-Git-Tag: v3.2.2rc1~157 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bbdc08ea6e5d3f2d9058991a65b6011dfbb8d233;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Lib/xml/dom/pulldom.py b/Lib/xml/dom/pulldom.py index 81a36b073e8e..d5ac8b2b9847 100644 --- a/Lib/xml/dom/pulldom.py +++ b/Lib/xml/dom/pulldom.py @@ -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: diff --git a/Misc/NEWS b/Misc/NEWS index 250acc2913e9..1d7669888f45 100644 --- 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 -----