Author: Carl Friedrich Bolz-Tereick <[email protected]>
Branch: record-known-result
Changeset: r97692:298551521a23
Date: 2019-10-01 10:52 +0200
http://bitbucket.org/pypy/pypy/changeset/298551521a23/

Log:    another record_known_result: the content of W_UnicodeObject is known
        to be a valid utf8 string

diff --git a/pypy/objspace/std/unicodeobject.py 
b/pypy/objspace/std/unicodeobject.py
--- a/pypy/objspace/std/unicodeobject.py
+++ b/pypy/objspace/std/unicodeobject.py
@@ -102,6 +102,7 @@
         return space.text_w(encode_object(space, self, 'ascii', 'strict'))
 
     def utf8_w(self, space):
+        jit.record_known_result(self._length, rutf8._check_utf8, self._utf8, 
True, 0, -1)
         return self._utf8
 
     def readbuf_w(self, space):
@@ -1012,8 +1013,8 @@
         if res_index < 0:
             return None
         res = self._byte_to_index(res_index)
+        jit.promote(res >= 0)  # always true!
         assert res >= 0
-        jit.promote(res >= 0)  # always true!
         return space.newint(res)
 
     def _unwrap_and_compute_idx_params(self, space, w_start, w_end):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to