dev-python/lz4: Bump to py3.10

Signed-off-by: Ekaterina Vaartis <vaartis@kotobank.ch>
Closes: https://github.com/gentoo/gentoo/pull/21074
Signed-off-by: Michał Górny <mgorny@gentoo.org>
This commit is contained in:
Ekaterina Vaartis
2021-06-01 17:50:27 +03:00
committed by Michał Górny
parent e0908b325e
commit 21d3fe0425
2 changed files with 37 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
diff --git a/lz4/frame/__init__.py b/lz4/frame/__init__.py
index 5fa03ce..b77c425 100644
--- a/lz4/frame/__init__.py
+++ b/lz4/frame/__init__.py
@@ -617,6 +617,17 @@ class LZ4FrameFile(_compression.BaseStream):
# returns at least one byte (except at EOF)
return self._buffer.peek(size)
+ def readall(self):
+ chunks = bytearray()
+
+ while True:
+ data = self.read(io.DEFAULT_BUFFER_SIZE)
+ chunks += data
+ if not data:
+ break
+
+ return bytes(chunks)
+
def read(self, size=-1):
"""Read up to ``size`` uncompressed bytes from the file.
@@ -632,6 +643,9 @@ class LZ4FrameFile(_compression.BaseStream):
"""
self._check_can_read()
+
+ if size < 0 and sys.version_info >= (3, 10):
+ return self.readall()
return self._buffer.read(size)
def read1(self, size=-1):

View File

@@ -3,7 +3,7 @@
EAPI=7
PYTHON_COMPAT=( python3_{7..9} )
PYTHON_COMPAT=( python3_{7..10} )
inherit distutils-r1
@@ -25,4 +25,8 @@ BDEPEND="
)
"
PATCHES=(
"${FILESDIR}/${P}-310-readall.patch"
)
distutils_enable_tests pytest