Skip to content

Commit 2ca1527

Browse files
committed
upip: upip_utarfile.skip(): Optimize for memory usage.
1 parent 2696367 commit 2ca1527

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

upip/upip_utarfile.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@ def readinto(self, buf):
3939
return sz
4040

4141
def skip(self):
42-
self.f.read(self.content_len + self.align)
42+
sz = self.content_len + self.align
43+
if sz:
44+
buf = bytearray(16)
45+
while sz:
46+
s = min(sz, 16)
47+
self.f.readinto(buf, s)
48+
sz -= s
4349

4450
class TarInfo:
4551

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