Skip to content

Commit 841dbd8

Browse files
committed
Use shutil.copyfileobj to do file object copying
1 parent 17829b6 commit 841dbd8

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/isal/igzip.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import gzip
3434
import io
3535
import os
36+
import shutil
3637
import struct
3738
import sys
3839
import time
@@ -358,11 +359,7 @@ def main():
358359
out_file = sys.stdout.buffer
359360

360361
try:
361-
while True:
362-
block = in_file.read(args.buffer_size)
363-
if block == b"":
364-
break
365-
out_file.write(block)
362+
shutil.copyfileobj(in_file, out_file, args.buffer_size)
366363
finally:
367364
if in_file is not sys.stdin.buffer:
368365
in_file.close()

0 commit comments

Comments
 (0)