Skip to content

Commit 7b3a2c0

Browse files
committed
upip: Update utarfile module, readinto() support.
1 parent 31c4957 commit 7b3a2c0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

upip/upip_utarfile.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ def read(self, sz=65536):
3535
self.content_len -= sz
3636
return data
3737

38+
def readinto(self, buf):
39+
if self.content_len == 0:
40+
return 0
41+
if len(buf) > self.content_len:
42+
buf = memoryview(buf)[:self.content_len]
43+
sz = self.f.readinto(buf)
44+
self.content_len -= sz
45+
return sz
46+
3847
def skip(self):
3948
self.f.read(self.content_len + self.align)
4049

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy