[pypy-commit] pypy default: fix translation (why does the same code work on py3.6?)

cfbolz pypy.commits at gmail.com
Sat Feb 8 07:43:43 EST 2020


Author: Carl Friedrich Bolz-Tereick <cfbolz at gmx.de>
Branch: 
Changeset: r98686:57362e78ee31
Date: 2020-02-08 13:31 +0100
http://bitbucket.org/pypy/pypy/changeset/57362e78ee31/

Log:	fix translation (why does the same code work on py3.6?)

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
@@ -131,7 +131,7 @@
 
     def listview_ascii(self):
         if self.is_ascii():
-            return list(self._utf8)
+            return _create_list_from_unicode(self._utf8)
         return None
 
     def ord(self, space):
@@ -1808,6 +1808,10 @@
 )
 W_UnicodeObject.typedef.flag_sequence_bug_compat = True
 
+def _create_list_from_unicode(value):
+    # need this helper function to allow the jit to look inside and inline
+    # listview_ascii
+    return [s for s in value]
 
 W_UnicodeObject.EMPTY = W_UnicodeObject('', 0)
 


More information about the pypy-commit mailing list