Skip to content

Commit 22886b1

Browse files
committed
Fixed recent regression of recent minor charsUntil optimisation
--HG-- extra : convert_revision : svn%3Aacbfec75-9323-0410-a652-858a13e371e0/trunk%401245
1 parent c6f0940 commit 22886b1

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

src/html5lib/inputstream.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -343,15 +343,20 @@ def charsUntil(self, characters, opposite = False):
343343
# Find the longest matching prefix
344344
m = chars.match(self.chunk, self.chunkOffset)
345345
if m is None:
346-
end = self.chunkOffset
346+
# If nothing matched, and it wasn't because we ran out of chunk,
347+
# then stop
348+
if self.chunkOffset != self.chunkSize:
349+
break
347350
else:
348351
end = m.end()
349-
# If not everything matched, return everything up to the part that didn't match
350-
if end != self.chunkSize:
351-
rv.append(self.chunk[self.chunkOffset:end])
352-
self.chunkOffset = end
353-
break
354-
# If the whole chunk matched, use it all and read the next chunk
352+
# If not the whole chunk matched, return everything
353+
# up to the part that didn't match
354+
if end != self.chunkSize:
355+
rv.append(self.chunk[self.chunkOffset:end])
356+
self.chunkOffset = end
357+
break
358+
# If the whole remainder of the chunk matched,
359+
# use it all and read the next chunk
355360
rv.append(self.chunk[self.chunkOffset:])
356361
if not self.readChunk():
357362
# Reached EOF

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