Skip to content

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

@barneygale

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibPython modules in the Lib dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy