Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve pathname2url() and url2pathname() docs #127125

Merged
merged 4 commits into from
Nov 24, 2024

Commits on Nov 22, 2024

  1. Improve pathname2url() and url2pathname() docs

    These functions have long sown confusion among Python developers. Even in
    the urllib implementation and tests, they seem to be used in contradictory
    ways. A test helper named `sanepathname2url()` has been with us since 2004!
    
    The existing documentation says that these functions deal with URL path
    components. But that doesn't fit the evidence on Windows:
    
        >>> pathname2url(r'C:\foo')
        '///C:/foo'
        >>> pathname2url(r'\\server\share')
        '////server/share'  # or '//server/share' as of quite recently
    
    If these were URL path components, they would imply complete URLs like
    `file://///C:/foo` and `file://////server/share`. Clearly this isn't right.
    
    The conclusion I draw is that these functions operate on everything after
    the `file:` prefix, which may include an authority section.
    barneygale committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    6c6e5e2 View commit details
    Browse the repository at this point in the history

Commits on Nov 23, 2024

  1. Add examples

    barneygale committed Nov 23, 2024
    Configuration menu
    Copy the full SHA
    efc7c84 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    cea4967 View commit details
    Browse the repository at this point in the history

Commits on Nov 24, 2024

  1. Address review feedback

    barneygale committed Nov 24, 2024
    Configuration menu
    Copy the full SHA
    4ae0e22 View commit details
    Browse the repository at this point in the history