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

Update os.path for PEP 519/__fspath__() #71711

Closed
brettcannon opened this issue Jul 15, 2016 · 6 comments
Closed

Update os.path for PEP 519/__fspath__() #71711

brettcannon opened this issue Jul 15, 2016 · 6 comments
Assignees
Labels
release-blocker stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@brettcannon
Copy link
Member

BPO 27524
Nosy @brettcannon, @ned-deily, @ethanfurman
Dependencies
  • bpo-26027: Support Path objects in the posix module
  • bpo-27184: Support path objects in the ntpath module
  • Files
  • fspath_tests.diff
  • os_path.diff: Tests and fixes not involving stat or lstat
  • 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 = 'https://github.com/brettcannon'
    closed_at = <Date 2016-08-26.21:46:15.496>
    created_at = <Date 2016-07-15.21:06:32.888>
    labels = ['type-bug', 'library', 'release-blocker']
    title = 'Update os.path for PEP 519/__fspath__()'
    updated_at = <Date 2016-09-06.22:59:12.300>
    user = 'https://github.com/brettcannon'

    bugs.python.org fields:

    activity = <Date 2016-09-06.22:59:12.300>
    actor = 'python-dev'
    assignee = 'brett.cannon'
    closed = True
    closed_date = <Date 2016-08-26.21:46:15.496>
    closer = 'brett.cannon'
    components = ['Library (Lib)']
    creation = <Date 2016-07-15.21:06:32.888>
    creator = 'brett.cannon'
    dependencies = ['26027', '27184']
    files = ['43740', '43941']
    hgrepos = []
    issue_num = 27524
    keywords = ['patch']
    message_count = 6.0
    messages = ['270513', '270519', '271645', '271654', '273733', '274655']
    nosy_count = 4.0
    nosy_names = ['brett.cannon', 'ned.deily', 'ethan.furman', 'python-dev']
    pr_nums = []
    priority = 'release blocker'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue27524'
    versions = ['Python 3.6']

    @brettcannon
    Copy link
    Member Author

    As per PEP-519, os.path needs to be updated to support __fspath__().

    @brettcannon brettcannon self-assigned this Jul 15, 2016
    @brettcannon brettcannon added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Jul 15, 2016
    @brettcannon
    Copy link
    Member Author

    Here are tests for genericpath, posixpath, and ntpath (which should in the end cover all of os.path).

    @brettcannon
    Copy link
    Member Author

    Ran into the first nasty snag: people are abusing os.path.commonprefix() and it's extremely generic approach. Instead of passing in a list of file paths they are passing a list of lists of file path *parts*, e.g. instead of ["a/b", "a/c"] they are passing in [["a", "b"], ["a", "c"]]. I have special-cased when the list contains another list or tuple, but I still feel dirty doing it.

    @brettcannon
    Copy link
    Member Author

    Here is a patch that includes the previous tests as long with fixes which don't involve stat or lstat (once those functions are updated themselves then os.path will be ported).

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Aug 26, 2016

    New changeset b64f83d6ff24 by Brett Cannon in branch 'default':
    Issue bpo-26027, bpo-27524: Add PEP 519/fspath() support to os and
    https://hg.python.org/cpython/rev/b64f83d6ff24

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 6, 2016

    New changeset 9be0286772bf by Brett Cannon in branch 'default':
    Issue bpo-26027, bpo-27524: Document the support for path-like objects in os and os.path.
    https://hg.python.org/cpython/rev/9be0286772bf

    @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
    release-blocker stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant