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

Remove pathlib accessors #87178

Closed
barneygale mannequin opened this issue Jan 23, 2021 · 5 comments
Closed

Remove pathlib accessors #87178

barneygale mannequin opened this issue Jan 23, 2021 · 5 comments
Labels
3.11 only security fixes performance Performance or resource usage stdlib Python modules in the Lib dir

Comments

@barneygale
Copy link
Mannequin

barneygale mannequin commented Jan 23, 2021

BPO 43012
Nosy @pitrou, @ericvsmith, @merwok, @encukou, @eryksun, @miss-islington, @barneygale
PRs
  • bpo-43012: remove pathlib._Accessor #25701
  • 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 2022-02-02.15:37:05.067>
    created_at = <Date 2021-01-23.18:15:55.455>
    labels = ['3.11', 'library', 'performance']
    title = 'Remove pathlib accessors'
    updated_at = <Date 2022-02-02.15:37:05.063>
    user = 'https://github.com/barneygale'

    bugs.python.org fields:

    activity = <Date 2022-02-02.15:37:05.063>
    actor = 'eric.araujo'
    assignee = 'none'
    closed = True
    closed_date = <Date 2022-02-02.15:37:05.067>
    closer = 'eric.araujo'
    components = ['Library (Lib)']
    creation = <Date 2021-01-23.18:15:55.455>
    creator = 'barneygale'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43012
    keywords = ['patch']
    message_count = 4.0
    messages = ['385556', '410732', '410733', '412353']
    nosy_count = 7.0
    nosy_names = ['pitrou', 'eric.smith', 'eric.araujo', 'petr.viktorin', 'eryksun', 'miss-islington', 'barneygale']
    pr_nums = ['25701']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'performance'
    url = 'https://bugs.python.org/issue43012'
    versions = ['Python 3.11']

    @barneygale
    Copy link
    Mannequin Author

    barneygale mannequin commented Jan 23, 2021

    Per Pitrou:

    The original intent for the “accessor” thing was to have a variant that did all accesses under a filesystem tree in a race condition-free way using openat and friends. It turned out to be much too hairy to actually implement, so was entirely abandoned, but the accessor abstraction was left there.

    https://discuss.python.org/t/make-pathlib-extensible/3428/2

    Accessors are:

    • Lacking any internal purpose - '_NormalAccessor' is the only implementation
    • Lacking any firm conceptual difference to Path objects themselves (inc. subclasses)
    • Non-public, i.e. underscore prefixed - '_Accessor' and '_NormalAccessor'
    • Unofficially used to implement customized Path objects, but once once bpo-24132 lands there will be a supported route for that.

    When bpo-24132 lands, I think we're free to remove accessors and simplify some code

    @barneygale barneygale mannequin added the stdlib Python modules in the Lib dir label Jan 23, 2021
    @barneygale barneygale mannequin added 3.11 only security fixes performance Performance or resource usage labels May 14, 2021
    @merwok
    Copy link
    Member

    merwok commented Jan 16, 2022

    PR looks good, just needs a look by a pathlib expert.

    @barneygale
    Copy link
    Mannequin Author

    barneygale mannequin commented Jan 16, 2022

    Thank you Éric!

    @miss-islington
    Copy link
    Contributor

    New changeset 08f8301 by Barney Gale in branch 'main':
    bpo-43012: remove pathlib._Accessor (GH-25701)
    08f8301

    @merwok merwok closed this as completed Feb 2, 2022
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @ronf
    Copy link

    ronf commented May 28, 2022

    This change is actually causing a problem for me. I have a unit test case which mocks out os.path.expanduser() but not the pathlib version. This works in 3.10 and earlier due to the indirection of the accessors, but in 3.11 the code ends up failing, since now the pathlib version of expanduser() is also getting into my mock.

    I wonder if there might be other code out there which also might be depending on this behavior, without even realizing it.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes performance Performance or resource usage stdlib Python modules in the Lib dir
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants