Skip to content

Commit f1b28b0

Browse files
committed
Avoid allocating bytes slice in encoding pre-parse
1 parent 0db23a3 commit f1b28b0

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

html5lib/_inputstream.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -658,9 +658,7 @@ def matchBytes(self, bytes):
658658
"""Look for a sequence of bytes at the start of a string. If the bytes
659659
are found return True and advance the position to the byte after the
660660
match. Otherwise return False and leave the position alone"""
661-
p = self.position
662-
data = self[p:p + len(bytes)]
663-
rv = data.startswith(bytes)
661+
rv = self.startswith(bytes, self.position)
664662
if rv:
665663
self.position += len(bytes)
666664
return rv

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