Skip to content

io.open_code should accept PathLike objects #83904

Closed

Description

@hauntsaninja
BPO 39723
Nosy @zooba, @tirkarthi, @hauntsaninja
PRs
  • bpo-39723: make io.open_code accept PathLike objects #18602
  • Superseder
  • bpo-39691: Allow passing Pathlike objects to io.open_code
  • 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 = <Date 2020-02-23.16:55:12.731>
    created_at = <Date 2020-02-22.05:43:48.358>
    labels = ['type-feature', 'library', '3.9']
    title = 'io.open_code should accept PathLike objects'
    updated_at = <Date 2020-02-23.16:55:12.730>
    user = 'https://github.com/hauntsaninja'

    bugs.python.org fields:

    activity = <Date 2020-02-23.16:55:12.730>
    actor = 'steve.dower'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-02-23.16:55:12.731>
    closer = 'steve.dower'
    components = ['Library (Lib)']
    creation = <Date 2020-02-22.05:43:48.358>
    creator = 'hauntsaninja'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39723
    keywords = ['patch']
    message_count = 3.0
    messages = ['362446', '362455', '362523']
    nosy_count = 3.0
    nosy_names = ['steve.dower', 'xtreak', 'hauntsaninja']
    pr_nums = ['18602']
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '39691'
    type = 'enhancement'
    url = 'https://bugs.python.org/issue39723'
    versions = ['Python 3.9']

    Activity

    1. hauntsaninja commented on Feb 22, 2020

      @hauntsaninja
      ContributorAuthor

      Currently io.open_code (added in Python 3.8) only accepts str arguments. As per PEP-519, it should probably also accept PathLike. It might be worth extending it to accept bytes as well, both for convenience and because documentation claims it should be interchangeable with open(path, 'rb').

      https://github.com/python/cpython/blob/3.8/Modules/_io/_iomodule.c#L510

    2. added
      stdlib
      type-feature
      on Feb 22, 2020
    3. tirkarthi commented on Feb 22, 2020

      @tirkarthi
      Member
    4. zooba commented on Feb 23, 2020

      @zooba
      Member

      Dup of bpo-39691

      As per PEP-578, open_code only accepts an absolute path as a str. The other issue will be used to update the docstring.

    5. transferred this issue fromon Apr 10, 2022
    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.9 (EOL)stdlibtype-feature

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions