This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: xml.sax.parse won't accept path objects
Type: behavior Stage: resolved
Components: Library (Lib), XML Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: craigh, mcepl, pitrou, scoder
Priority: normal Keywords: patch

Created on 2017-10-01 20:51 by craigh, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 8564 merged Tiger-222, 2018-07-30 12:43
Messages (4)
msg303490 - (view) Author: Craig Holmquist (craigh) Date: 2017-10-01 20:51
>>> import xml.sax
>>> import pathlib
[...]
>>> xml.sax.parse(pathlib.Path('path/to/file'), handler)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.6/xml/sax/__init__.py", line 33, in parse
    parser.parse(source)
  File "/usr/lib/python3.6/xml/sax/expatreader.py", line 105, in parse
    source = saxutils.prepare_input_source(source)
  File "/usr/lib/python3.6/xml/sax/saxutils.py", line 355, in prepare_input_source
    if source.getCharacterStream() is None and source.getByteStream() is None:
AttributeError: 'PosixPath' object has no attribute 'getCharacterStream'
msg340197 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2019-04-14 09:10
PR looks good to me. Doesn't look critical enough for a backport, though.
msg340198 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2019-04-14 09:17
New changeset 929b70473829f04dedb8e802abcbd506926886e1 by Stefan Behnel (Mickaël Schoentgen) in branch 'master':
bpo-31658: Make xml.sax.parse accepting Path objects (GH-8564)
https://github.com/python/cpython/commit/929b70473829f04dedb8e802abcbd506926886e1
msg340199 - (view) Author: Stefan Behnel (scoder) * (Python committer) Date: 2019-04-14 09:18
Thanks for your contribution.
History
Date User Action Args
2022-04-11 14:58:53adminsetgithub: 75839
2019-04-14 09:18:33scodersetmessages: + msg340199
2019-04-14 09:18:08scodersetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-04-14 09:17:12scodersetmessages: + msg340198
2019-04-14 09:10:24scodersetnosy: + scoder

messages: + msg340197
versions: - Python 3.6, Python 3.7
2019-01-14 18:45:07Tiger-222setversions: + Python 3.7, Python 3.8
2018-07-30 12:43:58Tiger-222setkeywords: + patch
stage: patch review
pull_requests: + pull_request8078
2018-03-05 00:37:50mceplsetnosy: + mcepl
2017-10-01 20:55:11rhettingersetnosy: + pitrou
2017-10-01 20:51:11craighcreate