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

Skip to content

[3.15] gh-156713: Use the filesystem encoding in nturl2path (GH-156717) - #157423

Open
miss-islington wants to merge 2 commits into
python:3.15from
miss-islington:backport-01599e2-3.15
Open

[3.15] gh-156713: Use the filesystem encoding in nturl2path (GH-156717)#157423
miss-islington wants to merge 2 commits into
python:3.15from
miss-islington:backport-01599e2-3.15

Conversation

@miss-islington

@miss-islington miss-islington commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

urllib.request.pathname2url() and url2pathname() use the filesystem encoding
and error handler since gh-85168, but nturl2path, which implements them on
Windows before 3.14, was left unchanged. Paths containing surrogate
characters raised UnicodeEncodeError.
(cherry picked from commit 01599e2)

Co-authored-by: Serhiy Storchaka [email protected]

…156717)

urllib.request.pathname2url() and url2pathname() use the filesystem encoding
and error handler since pythongh-85168, but nturl2path, which implements them on
Windows before 3.14, was left unchanged.  Paths containing surrogate
characters raised UnicodeEncodeError.
(cherry picked from commit 01599e2)

Co-authored-by: Serhiy Storchaka <[email protected]>
Since nturl2path uses the filesystem encoding, the expected results of
quoting non-ASCII characters depend on it.  Use os_helper.FS_NONASCII
and os_helper.TESTFN_UNDECODABLE, and skip the tests when there is no
suitable character or byte sequence for the current encoding.

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
(cherry picked from commit 3e1b5d8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants