summaryrefslogtreecommitdiffstats
path: root/Lib/xml/sax
diff options
context:
space:
mode:
authorMickaƫl Schoentgen <contact@tiger-222.fr>2019-04-14 09:16:54 (GMT)
committerStefan Behnel <stefan_ml@behnel.de>2019-04-14 09:16:54 (GMT)
commit929b70473829f04dedb8e802abcbd506926886e1 (patch)
tree6c0e66ff8e84eedf21dc36cfe87fb8967a09e6d5 /Lib/xml/sax
parente9927e1820caea01e576141d9a623ea394d43dad (diff)
downloadcpython-929b70473829f04dedb8e802abcbd506926886e1.zip
cpython-929b70473829f04dedb8e802abcbd506926886e1.tar.gz
cpython-929b70473829f04dedb8e802abcbd506926886e1.tar.bz2
bpo-31658: Make xml.sax.parse accepting Path objects (GH-8564)
Diffstat (limited to 'Lib/xml/sax')
-rw-r--r--Lib/xml/sax/saxutils.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/xml/sax/saxutils.py b/Lib/xml/sax/saxutils.py
index b4fc2da..c1612ea 100644
--- a/Lib/xml/sax/saxutils.py
+++ b/Lib/xml/sax/saxutils.py
@@ -339,6 +339,8 @@ def prepare_input_source(source, base=""):
"""This function takes an InputSource and an optional base URL and
returns a fully resolved InputSource object ready for reading."""
+ if isinstance(source, os.PathLike):
+ source = os.fspath(source)
if isinstance(source, str):
source = xmlreader.InputSource(source)
elif hasattr(source, "read"):