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

io.open_code should accept PathLike objects #83904

Closed
hauntsaninja opened this issue Feb 22, 2020 · 3 comments
Closed

io.open_code should accept PathLike objects #83904

hauntsaninja opened this issue Feb 22, 2020 · 3 comments
Labels
3.9 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@hauntsaninja
Copy link
Contributor

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']

    @hauntsaninja
    Copy link
    Contributor Author

    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

    @hauntsaninja hauntsaninja added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Feb 22, 2020
    @SilentGhost SilentGhost mannequin added 3.9 only security fixes labels Feb 22, 2020
    @tirkarthi
    Copy link
    Member

    This seems to be a duplicate of https://bugs.python.org/issue39691

    @zooba
    Copy link
    Member

    zooba commented Feb 23, 2020

    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.

    @zooba zooba closed this as completed Feb 23, 2020
    @zooba zooba closed this as completed Feb 23, 2020
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.9 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants