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

Exclusive mode for ZipFile and TarFile #65916

Closed
anntzer mannequin opened this issue Jun 11, 2014 · 12 comments
Closed

Exclusive mode for ZipFile and TarFile #65916

anntzer mannequin opened this issue Jun 11, 2014 · 12 comments
Assignees
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@anntzer
Copy link
Mannequin

anntzer mannequin commented Jun 11, 2014

BPO 21717
Nosy @gustaebel, @berkerpeksag, @serhiy-storchaka, @anntzer
Files
  • issue21717_tarfile.diff
  • issue21717_v2.diff
  • zipfile_mode_x.patch
  • issue21717_tarfile_v3.diff
  • issue21717_tarfile_v4.diff
  • issue21717_tarfile_v5.diff
  • 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/serhiy-storchaka'
    closed_at = <Date 2015-03-25.08:11:46.943>
    created_at = <Date 2014-06-11.10:26:20.641>
    labels = ['type-feature', 'library']
    title = 'Exclusive mode for ZipFile and TarFile'
    updated_at = <Date 2015-03-25.08:11:46.942>
    user = 'https://github.com/anntzer'

    bugs.python.org fields:

    activity = <Date 2015-03-25.08:11:46.942>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2015-03-25.08:11:46.943>
    closer = 'serhiy.storchaka'
    components = ['Library (Lib)']
    creation = <Date 2014-06-11.10:26:20.641>
    creator = 'Antony.Lee'
    dependencies = []
    files = ['35740', '38025', '38027', '38081', '38095', '38115']
    hgrepos = []
    issue_num = 21717
    keywords = ['patch']
    message_count = 12.0
    messages = ['220249', '221358', '235454', '235478', '235482', '235488', '235679', '235912', '235913', '239149', '239231', '239235']
    nosy_count = 5.0
    nosy_names = ['lars.gustaebel', 'python-dev', 'berker.peksag', 'serhiy.storchaka', 'Antony.Lee']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue21717'
    versions = ['Python 3.5']

    @anntzer
    Copy link
    Mannequin Author

    anntzer mannequin commented Jun 11, 2014

    I noticed that while lzma and bz2 already support the "x" (create a new file, raise if it already exists) flag, zipfile and tarfile don't know about it yet. It would be an useful addition, just as it is useful for regular open.

    A quick look at both modules show that this likely only requires a little bit more than updating the checks in the corresponding constructors to allow "x" mode, as the modes are passed (nearly) transparently to the open() builtin.

    @anntzer anntzer mannequin added the stdlib Python modules in the Lib dir label Jun 11, 2014
    @berkerpeksag
    Copy link
    Member

    Here's a patch for tarfile.

    @berkerpeksag berkerpeksag added the type-feature A feature request or enhancement label Jun 23, 2014
    @serhiy-storchaka
    Copy link
    Member

    Ping.

    @berkerpeksag
    Copy link
    Member

    Here's an updated patch. Thanks Serhiy.

    @serhiy-storchaka
    Copy link
    Member

    Added more comments.

    @serhiy-storchaka
    Copy link
    Member

    Here is a patch for zipfile.

    @berkerpeksag
    Copy link
    Member

    Updated patch. Thanks again, Serhiy.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Feb 13, 2015

    New changeset ed9e9e6b3c1e by Berker Peksag in branch 'default':
    Issue bpo-21717: tarfile.open() now supports 'x' (exclusive creation) mode.
    https://hg.python.org/cpython/rev/ed9e9e6b3c1e

    @berkerpeksag
    Copy link
    Member

    Thanks for the review, Serhiy. I'll take a look at the zipfile patch tomorrow.

    @serhiy-storchaka
    Copy link
    Member

    Could you look on zipfile patch Berker? It is simpler than tarfile patch.

    @serhiy-storchaka serhiy-storchaka self-assigned this Mar 24, 2015
    @berkerpeksag
    Copy link
    Member

    LGTM. I left two minor comments on Rietveld. Sorry for the delay.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 25, 2015

    New changeset b2a8c30d8ddb by Serhiy Storchaka in branch 'default':
    Issue bpo-21717: The zipfile.ZipFile.open function now supports 'x' (exclusive
    https://hg.python.org/cpython/rev/b2a8c30d8ddb

    @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
    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