Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bbdc08e

Browse files
author
Victor Stinner
committed
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.
1 parent ac91341 commit bbdc08e

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

Lib/xml/dom/pulldom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ def parse(stream_or_string, parser=None, bufsize=None):
326326
if bufsize is None:
327327
bufsize = default_bufsize
328328
if isinstance(stream_or_string, str):
329-
stream = open(stream_or_string)
329+
stream = open(stream_or_string, 'rb')
330330
else:
331331
stream = stream_or_string
332332
if not parser:

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ Core and Builtins
1919
Library
2020
-------
2121

22+
- Issue #12451: xml.dom.pulldom: parse() now opens files in binary mode instead
23+
of the text mode (using the locale encoding) to avoid encoding issues.
24+
2225
C-API
2326
-----
2427

0 commit comments

Comments
 (0)