Skip to content

Commit

Permalink
feat: ensure unpack_7zarchive closes the archive
Browse files Browse the repository at this point in the history
  • Loading branch information
francoisfreitag committed Apr 10, 2024
1 parent 606b50e commit e0e0abd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions py7zr/py7zr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1202,9 +1202,8 @@ def unpack_7zarchive(archive, path, extra=None):
"""
Function for registering with shutil.register_unpack_format().
"""
arc = SevenZipFile(archive)
arc.extractall(path)
arc.close()
with SevenZipFile(archive) as arc:
arc.extractall(path)


def pack_7zarchive(base_name, base_dir, owner=None, group=None, dry_run=None, logger=None):
Expand Down

0 comments on commit e0e0abd

Please sign in to comment.