Skip to content

Add os.path.fileuri() function #88578

Description

@barneygale
BPO 44412
Nosy @barneygale
PRs
  • bpo-44412: add os.path.fileuri() function. #26708
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2021-06-13.16:10:22.472>
    labels = ['type-feature', 'library', '3.11']
    title = 'Add os.path.fileuri() function'
    updated_at = <Date 2021-06-13.16:55:19.479>
    user = 'https://github.com/barneygale'

    bugs.python.org fields:

    activity = <Date 2021-06-13.16:55:19.479>
    actor = 'barneygale'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2021-06-13.16:10:22.472>
    creator = 'barneygale'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44412
    keywords = ['patch']
    message_count = 1.0
    messages = ['395756']
    nosy_count = 1.0
    nosy_names = ['barneygale']
    pr_nums = ['26708']
    priority = 'normal'
    resolution = None
    stage = 'patch review'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue44412'
    versions = ['Python 3.11']

    Activity

    1. barneygale commented on Jun 13, 2021

      barneygalemannequin
      MannequinAuthor

      Proposal:

      • Introduce os.path.fileuri() function that produces a 'file://' URI
      • Adjust PurePosixPath.to_uri() to call posixpath.fileuri()
      • Adjust PureWindowsPath.to_uri() to call ntpath.fileuri()
      • Adjust nturl2path.pathname2url() to call ntpath.fileuri()

      Rationale:

      • pathlib is 95% a wrapper around os and os.path. It implements
        little itself except the OOP interface. as_uri() is one of only a
        tiny handful of pathlib features that have no decent antecedents.
      • the existence of these OS-specific features complicates pathlib's
        internals, necessitating the existence of OS-specific '_Flavour'
        classes that greatly complicate work on bpo-24132
      • this is a useful feature with lots of stackoverflow posts. It seems
        silly to /require/ users to use pathlib for this, as the rest of their
        codebase may work just fine using traditional path manip.

      Further discussion on python-ideas: https://discuss.python.org/t/pathlib-and-os-path-feature-parity-and-code-de-duplication/9239

      Related: bpo-44403, bpo-44136, bpo-24132

    2. added
      3.11only security fixes
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      on Jun 13, 2021
    3. transferred this issue fromon Apr 10, 2022
    4. barneygale commented on Oct 30, 2024

      @barneygale
      ContributorAuthor

      Withdrawing this request in favour of #125866

    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

      3.11only security fixesstdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions