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

[Fix#534] IndexError / Worker initialization sets wrong last_file_index #535

Merged
merged 6 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion py7zr/py7zr.py
Original file line number Diff line number Diff line change
Expand Up @@ -1220,7 +1220,7 @@ def __init__(self, files, src_start: int, header, mp=False) -> None:
self.src_start = src_start
self.header = header
self.current_file_index = len(self.files)
self.last_file_index = len(self.files)
self.last_file_index = len(self.files) - 1
if mp:
self.concurrent: Union[Type[Thread], Type[Process]] = Process
else:
Expand Down
6 changes: 6 additions & 0 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,9 @@ def test_py7zr_list_values():
assert file_list[1].crc32 == 0xB36AAEDB
assert file_list[2].crc32 == 0xDCBF8D07
assert file_list[3].crc32 == 0x80FC72BE

@pytest.mark.basic
baterflyrity marked this conversation as resolved.
Show resolved Hide resolved
def test_multiple_uses():
with py7zr.SevenZipFile(os.path.join(testdata_path, "test_multiple.7z"), "w") as archive:
archive.writestr('1', '1.txt')
miurahr marked this conversation as resolved.
Show resolved Hide resolved
archive.test()
Loading