Skip to content

url2pathname() mishandles URL with Windows drive in netloc #137059

Closed

Description

@barneygale

Bug report

Bug description:

Windows-specific regression in Python 3.14 caused by d783d7b

Some programs generate file URLs by adding a file:// prefix to a path. On Windows, this can result in URLs like file://C:/foo. Though these URLs are malformed, they were correctly handled by urllib.request.url2pathname() until 3.14.

>>> from urllib.request import url2pathname
>>> url2pathname('//C:/foo')
'\\\\C:\\foo'  # expected 'C:\\foo'

CPython versions tested on:

3.14

Operating systems tested on:

No response

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    stdlibStandard Library Python modules in the Lib/ directory
    on Jul 23, 2025
  2. changed the title [-]`url2pathname()` mishandles URLs with Windows drive in netloc[/-] [+]`url2pathname()` mishandles URL with Windows drive in netloc[/+] on Jul 23, 2025
  3. added a commit that references this issue on Jul 23, 2025
  4. serhiy-storchaka commented on Jul 24, 2025

    @serhiy-storchaka
    Member

    Note that there will also be issues if the path contains # (after #136874) or %. On Posix -- also if the path contains ?.

  5. added a commit that references this issue on Jul 27, 2025
  6. added a commit that references this issue on Jul 27, 2025
  7. added a commit that references this issue on Jul 28, 2025
  8. added a commit that references this issue on Aug 19, 2025
  9. added a commit that references this issue on Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions