Skip to content

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Nov 24, 2024

@serhiy-storchaka serhiy-storchaka force-pushed the pathname2url-double-slash branch from 597e382 to a206e1a Compare November 24, 2024 10:46
Copy link
Contributor

@barneygale barneygale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@serhiy-storchaka serhiy-storchaka merged commit 97b2cea into python:main Nov 24, 2024
41 checks passed
@miss-islington-app
Copy link

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

@serhiy-storchaka serhiy-storchaka deleted the pathname2url-double-slash branch November 24, 2024 17:30
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 24, 2024
…slashes on Posix (pythonGH-127218)

(cherry picked from commit 97b2cea)

Co-authored-by: Serhiy Storchaka <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Nov 24, 2024
…slashes on Posix (pythonGH-127218)

(cherry picked from commit 97b2cea)

Co-authored-by: Serhiy Storchaka <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Nov 24, 2024

GH-127230 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Nov 24, 2024
@bedevere-app
Copy link

bedevere-app bot commented Nov 24, 2024

GH-127231 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Nov 24, 2024
serhiy-storchaka added a commit that referenced this pull request Nov 24, 2024
… slashes on Posix (GH-127218) (GH-127231)

(cherry picked from commit 97b2cea)

Co-authored-by: Serhiy Storchaka <[email protected]>
serhiy-storchaka added a commit that referenced this pull request Nov 30, 2024
… slashes on Posix (GH-127218) (GH-127230)

(cherry picked from commit 97b2cea)

Co-authored-by: Serhiy Storchaka <[email protected]>
ebonnal pushed a commit to ebonnal/cpython that referenced this pull request Jan 12, 2025
biergaizi added a commit to fasterEMS/fasterEMS that referenced this pull request Nov 20, 2025
Currently the detected "file://" path URLs are generated by
appending an absolute path (e.g. "/home") to a "file://localhost/"
prefix, so there's a redundant slash at the end of the URL
(e.g. "file://localhost//home"). This is harmless. Unfortunately,
some Python versions had a serious bug [1][2], which doesn't
parse this URL correctly:

    $ python3.14 -c "import urllib.request; urllib.request.url2pathname('//home')"
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
        import urllib.request; urllib.request.url2pathname('//home')
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
      File "/usr/local/Cellar/[email protected]/3.14.0_1/Frameworks/Python.framework/Versions/3.14/lib/python3.14/urllib/request.py", line 1681, in url2pathname
        raise URLError("file:// scheme is supported only on localhost")
    urllib.error.URLError: <urlopen error file:// scheme is supported only on localhost>

This bug has already been fixed in all non-alpha version of Python
3.14, but for unknown reasons, the shipped Python 3.14 still contains
an unfixed standard library [3].

This commit just removes the extra slash to avoid triggering the bug.

[1] python/cpython#127218
[2] python/cpython@97b2cea

Signed-off-by: Yifeng Li <[email protected]>
biergaizi added a commit to fasterEMS/fasterEMS that referenced this pull request Nov 20, 2025
Currently the detected "file://" path URLs are generated by
appending an absolute path (e.g. "/home") to a "file://localhost/"
prefix, so there's a redundant slash at the end of the URL
(e.g. "file://localhost//home"). This is harmless. Unfortunately,
some Python versions had a serious bug [1][2], which doesn't
parse this URL correctly:

    $ python3.14 -c "import urllib.request; urllib.request.url2pathname('//home')"
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
        import urllib.request; urllib.request.url2pathname('//home')
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
      File "/usr/local/Cellar/[email protected]/3.14.0_1/Frameworks/Python.framework/Versions/3.14/lib/python3.14/urllib/request.py", line 1681, in url2pathname
        raise URLError("file:// scheme is supported only on localhost")
    urllib.error.URLError: <urlopen error file:// scheme is supported only on localhost>

This bug has already been fixed in all non-alpha versions of Python
3.14, but for unknown reasons, macOS Homebrew is still shipping a
Python 3.14 with an unfixed standard library [3].

This commit just removes the extra slash to avoid triggering the bug.

[1] python/cpython#127218
[2] python/cpython@97b2cea

Signed-off-by: Yifeng Li <[email protected]>
biergaizi added a commit to fasterEMS/fasterEMS that referenced this pull request Nov 20, 2025
Currently the detected "file://" path URLs are generated by
appending an absolute path (e.g. "/home") to a "file://localhost/"
prefix, so there's a redundant slash at the end of the URL
(e.g. "file://localhost//home"). This is harmless. Unfortunately,
some Python versions had a serious bug [1][2], which doesn't
parse this URL correctly:

    $ python3.14 -c "import urllib.request; urllib.request.url2pathname('//home')"
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
        import urllib.request; urllib.request.url2pathname('//home')
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
      File "/usr/local/Cellar/[email protected]/3.14.0_1/Frameworks/Python.framework/Versions/3.14/lib/python3.14/urllib/request.py", line 1681, in url2pathname
        raise URLError("file:// scheme is supported only on localhost")
    urllib.error.URLError: <urlopen error file:// scheme is supported only on localhost>

This bug has already been fixed in all non-alpha versions of Python
3.14, but for unknown reasons, macOS Homebrew is still shipping a
Python 3.14 with an unfixed standard library.

This commit just removes the extra slash to avoid triggering the bug.

[1] python/cpython#127218
[2] python/cpython@97b2cea

Signed-off-by: Yifeng Li <[email protected]>
thliebig pushed a commit to thliebig/openEMS that referenced this pull request Nov 20, 2025
Currently the detected "file://" path URLs are generated by
appending an absolute path (e.g. "/home") to a "file://localhost/"
prefix, so there's a redundant slash at the end of the URL
(e.g. "file://localhost//home"). This is harmless. Unfortunately,
some Python versions had a serious bug [1][2], which doesn't
parse this URL correctly:

    $ python3.14 -c "import urllib.request; urllib.request.url2pathname('//home')"
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
        import urllib.request; urllib.request.url2pathname('//home')
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^
      File "/usr/local/Cellar/[email protected]/3.14.0_1/Frameworks/Python.framework/Versions/3.14/lib/python3.14/urllib/request.py", line 1681, in url2pathname
        raise URLError("file:// scheme is supported only on localhost")
    urllib.error.URLError: <urlopen error file:// scheme is supported only on localhost>

This bug has already been fixed in all non-alpha versions of Python
3.14, but for unknown reasons, macOS Homebrew is still shipping a
Python 3.14 with an unfixed standard library.

This commit just removes the extra slash to avoid triggering the bug.

[1] python/cpython#127218
[2] python/cpython@97b2cea

Signed-off-by: Yifeng Li <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants