mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
bpo-31658: Make xml.sax.parse accepting Path objects (GH-8564)
This commit is contained in:
parent
e9927e1820
commit
929b704738
4 changed files with 21 additions and 2 deletions
|
@ -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"):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue