Commit b2963a10 authored by Carl Friedrich Bolz-Tereick's avatar Carl Friedrich Bolz-Tereick
Browse files

call _advance_codepoint only if we don't already know that we have an ascii char

--HG--
branch : py3.7
parent 6f9f80a965c9
......@@ -417,7 +417,8 @@ class DecodeBuffer(object):
return False
ch = self.text[self.pos]
if ch == '\n':
self._advance_codepoint()
self.pos += 1
self.upos += 1
return True
else:
return True
......@@ -431,9 +432,10 @@ class DecodeBuffer(object):
if self.exhausted():
return False
ch = self.text[self.pos]
self._advance_codepoint()
scanned += 1
if ch == '\r':
self.pos += 1
self.upos += 1
if scanned >= limit:
return False
if self.exhausted():
......@@ -443,8 +445,11 @@ class DecodeBuffer(object):
self.upos -= 1
return False
if self.text[self.pos] == '\n':
self._advance_codepoint()
self.pos += 1
self.upos += 1
return True
else:
self._advance_codepoint()
return False
def find_char(self, marker, limit):
......@@ -477,9 +482,11 @@ class DecodeBuffer(object):
return False
# this is never true if self.text[pos] is part of a larger char
found = self.text[self.pos] == marker
self._advance_codepoint()
if found:
self.pos += 1
self.upos += 1
return True
self._advance_codepoint()
scanned += 1
return False
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment