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

pathlib: move 'resolve()' logic out of path flavour #87923

Closed
barneygale mannequin opened this issue Apr 7, 2021 · 5 comments
Closed

pathlib: move 'resolve()' logic out of path flavour #87923

barneygale mannequin opened this issue Apr 7, 2021 · 5 comments
Labels
3.10 stdlib type-feature

Comments

@barneygale
Copy link
Mannequin

@barneygale barneygale mannequin commented Apr 7, 2021

BPO 43757
Nosy @eryksun, @zooba, @willingc, @miss-islington, @barneygale
PRs
  • #25264
  • #26088
  • #26090
  • #26099
  • #26270
  • 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 2021-04-28.15:50:36.035>
    created_at = <Date 2021-04-07.02:32:48.519>
    labels = ['type-feature', 'library', '3.10']
    title = "pathlib: move 'resolve()' logic out of path flavour"
    updated_at = <Date 2021-05-21.11:55:03.340>
    user = 'https://github.com/barneygale'

    bugs.python.org fields:

    activity = <Date 2021-05-21.11:55:03.340>
    actor = 'miss-islington'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-04-28.15:50:36.035>
    closer = 'steve.dower'
    components = ['Library (Lib)']
    creation = <Date 2021-04-07.02:32:48.519>
    creator = 'barneygale'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43757
    keywords = ['patch']
    message_count = 5.0
    messages = ['390397', '391962', '392229', '393623', '394107']
    nosy_count = 5.0
    nosy_names = ['eryksun', 'steve.dower', 'willingc', 'miss-islington', 'barneygale']
    pr_nums = ['25264', '26088', '26090', '26099', '26270']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue43757'
    versions = ['Python 3.10']

    @barneygale
    Copy link
    Mannequin Author

    @barneygale barneygale mannequin commented Apr 7, 2021

    Under-the-hood functionality in pathlib is divided between:

    • The 'flavour', which implements path syntax (separators, casefolding, etc)
    • The 'accessor', which accesses the local (file)system.

    The '_WindowsFlavour/_PosixFlavour.resolve()' function is misplaced, as it requires OS calls such as os.getcwd(), os.readlink(), and nt._getfinalpathname(). While the implementation does differ across Windows and POSIX, it's still properly part of the accessor interface, and not the flavour interface.

    In preparation for addressing bpo-24132 I'd like to get these interfaces really tidy. Once bpo-39899 is fixed, this will be the last remaining flavour method that does accessor-y things.

    @barneygale barneygale mannequin added 3.10 stdlib type-feature labels Apr 7, 2021
    @zooba
    Copy link
    Member

    @zooba zooba commented Apr 26, 2021

    I'm happy with the PR as it stands now. Anyone else have an opinion?

    @zooba
    Copy link
    Member

    @zooba zooba commented Apr 28, 2021

    New changeset baecfbd by Barney Gale in branch 'master':
    bpo-43757: Make pathlib use os.path.realpath() to resolve symlinks in a path (GH-25264)
    baecfbd

    @zooba zooba closed this as completed Apr 28, 2021
    @zooba zooba closed this as completed Apr 28, 2021
    @willingc
    Copy link
    Sponsor Contributor

    @willingc willingc commented May 14, 2021

    New changeset ea14a07 by Miss Islington (bot) in branch '3.10':
    bpo-43757: Document os.path.realpath(strict=True) in 3.10 whatsnew. (GH-26090) (bpo-26099)
    ea14a07

    @miss-islington
    Copy link
    Contributor

    @miss-islington miss-islington commented May 21, 2021

    New changeset ee51c56 by Barney Gale in branch '3.10':
    [3.10] bpo-38671: Add test that pathlib.Path.resolve() returns an absolute path. (GH-26184) (GH-26270)
    ee51c56

    @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.10 stdlib type-feature
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants