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

zipfile.Path should support inheritance #86209

Closed
conchylicultor mannequin opened this issue Oct 15, 2020 · 4 comments
Closed

zipfile.Path should support inheritance #86209

conchylicultor mannequin opened this issue Oct 15, 2020 · 4 comments
Labels
3.10 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@conchylicultor
Copy link
Mannequin

conchylicultor mannequin commented Oct 15, 2020

BPO 42043
Nosy @jaraco, @FFY00, @Conchylicultor
PRs
  • bpo-42043: Inheritance support for zipfile.Path for .parent, /, joinpath #22711
  • bpo-42043: Add support for zipfile.Path subclasses #22716
  • 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-05-24.18:41:22.935>
    created_at = <Date 2020-10-15.12:03:28.536>
    labels = ['type-feature', 'library', '3.10']
    title = 'zipfile.Path should support inheritance'
    updated_at = <Date 2021-05-24.18:41:22.934>
    user = 'https://github.com/conchylicultor'

    bugs.python.org fields:

    activity = <Date 2021-05-24.18:41:22.934>
    actor = 'jaraco'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-05-24.18:41:22.935>
    closer = 'jaraco'
    components = ['Library (Lib)']
    creation = <Date 2020-10-15.12:03:28.536>
    creator = 'conchylicultor'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 42043
    keywords = ['patch']
    message_count = 4.0
    messages = ['378678', '378695', '379601', '394262']
    nosy_count = 4.0
    nosy_names = ['jaraco', 'python-dev', 'FFY00', 'conchylicultor']
    pr_nums = ['22711', '22716']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue42043'
    versions = ['Python 3.10']

    @conchylicultor
    Copy link
    Mannequin Author

    conchylicultor mannequin commented Oct 15, 2020

    Currently, zipfile.Path inheritance behavior is inconsistent with pathlib.Path:

    class MyPath(zipfile.Path):
      pass
    
    
    path = MyPath(zf)
    path = path.joinpath('other')
    assert isinstance(path, MyPath)  # Oups, type(path) is zipfile.Path
    

    Calling parent, /,... should keep the class, as for pathlib.Path

    Use case: I'm writing a wrapper around zipfile.Path which adds os.fspath compatibility (the file is extracted in a tmp dir when os.path.join, open,...).

    @conchylicultor conchylicultor mannequin added 3.10 only security fixes stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Oct 15, 2020
    @jaraco
    Copy link
    Member

    jaraco commented Oct 15, 2020

    This issue was addressed incidentally in jaraco/zipp#56 released as zipp 3.2.0.

    I'd like to incorporate the tests submitted in PR 22711 and then port those changes to Python.

    @jaraco
    Copy link
    Member

    jaraco commented Oct 25, 2020

    New changeset d1a0a96 by Jason R. Coombs in branch 'master':
    bpo-42043: Add support for zipfile.Path subclasses (bpo-22716)
    d1a0a96

    @FFY00
    Copy link
    Member

    FFY00 commented May 24, 2021

    This can be closed now.

    @jaraco jaraco closed this as completed May 24, 2021
    @jaraco jaraco closed this as completed May 24, 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.10 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

    2 participants