Author: Carl Friedrich Bolz-Tereick <cfb...@gmx.de>
Branch: py3.6
Changeset: r97456:41c694d4618d
Date: 2019-09-12 11:12 +0200
http://bitbucket.org/pypy/pypy/changeset/41c694d4618d/

Log:    merge default

diff --git a/pypy/module/_io/interp_textio.py b/pypy/module/_io/interp_textio.py
--- a/pypy/module/_io/interp_textio.py
+++ b/pypy/module/_io/interp_textio.py
@@ -442,8 +442,24 @@
     def find_char(self, marker, limit):
         # only works for ascii markers!
         assert 0 <= ord(marker) < 128
+        # ascii fast path
+        if self.ulen == len(self.text):
+            if limit < 0:
+                end = len(self.text)
+            else:
+                end = self.pos + limit
+            pos = self.text.find(marker, self.pos, end)
+            if pos >= 0:
+                self.pos = self.upos = pos + 1
+                return True
+            else:
+                self.pos = self.upos = end
+                return False
+
         if limit < 0:
             limit = sys.maxint
+        # XXX it might be better to search for the marker quickly, then compute
+        # the new upos afterwards.
         scanned = 0
         while scanned < limit:
             # don't use next_char here, since that computes a slice etc
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to