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 calls os.getcwd() without using accessor #83840

Closed
barneygale mannequin opened this issue Feb 17, 2020 · 4 comments
Closed

pathlib calls os.getcwd() without using accessor #83840

barneygale mannequin opened this issue Feb 17, 2020 · 4 comments
Labels
3.9 only security fixes stdlib Python modules in the Lib dir

Comments

@barneygale
Copy link
Mannequin

barneygale mannequin commented Feb 17, 2020

BPO 39659
Nosy @pitrou, @zooba, @eamanu, @barneygale
PRs
  • bpo-39659: Route calls from pathlib.Path to os.getcwd() via the path accessor #18834
  • 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-07.18:32:57.069>
    created_at = <Date 2020-02-17.00:57:41.837>
    labels = ['library', '3.9']
    title = 'pathlib calls `os.getcwd()` without using accessor'
    updated_at = <Date 2021-04-07.18:32:57.069>
    user = 'https://github.com/barneygale'

    bugs.python.org fields:

    activity = <Date 2021-04-07.18:32:57.069>
    actor = 'steve.dower'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-04-07.18:32:57.069>
    closer = 'steve.dower'
    components = ['Library (Lib)']
    creation = <Date 2020-02-17.00:57:41.837>
    creator = 'barneygale'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 39659
    keywords = ['patch']
    message_count = 4.0
    messages = ['362114', '362138', '362157', '390446']
    nosy_count = 4.0
    nosy_names = ['pitrou', 'steve.dower', 'eamanu', 'barneygale']
    pr_nums = ['18834']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue39659'
    versions = ['Python 3.9']

    @barneygale
    Copy link
    Mannequin Author

    barneygale mannequin commented Feb 17, 2020

    Whereas most calls to os functions from pathlib.Path methods happen via pathlib._Accessor methods, retrieving the current working directory does not. This problem occurs when calling the pathlib.Path.cwd(), ~resolve() and ~absolute() methods.

    @barneygale barneygale mannequin added 3.9 only security fixes stdlib Python modules in the Lib dir labels Feb 17, 2020
    @eamanu
    Copy link
    Mannequin

    eamanu mannequin commented Feb 17, 2020

    Sorry, I cannot catch what is the problem of not use _Accesor on PurePath class

    @barneygale
    Copy link
    Mannequin Author

    barneygale mannequin commented Feb 17, 2020

    Those methods are non-pure, i.e. part of Path but not PurePath. Only impure paths have accessors. The _Accessor docstring says: "an accessor implements a particular (system-specific or not) way of accessing paths on the filesystem". This abstraction is pretty pointless if covers os.readlink() but not os.getcwd()!

    @zooba
    Copy link
    Member

    zooba commented Apr 7, 2021

    New changeset b05440c by Barney Gale in branch 'master':
    bpo-39659: Route calls from pathlib.Path to os.getcwd() via the path accessor (GH-18834)
    b05440c

    @zooba zooba closed this as completed Apr 7, 2021
    @zooba zooba closed this as completed Apr 7, 2021
    @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
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant