Author: Armin Rigo <[email protected]>
Branch: py3.5
Changeset: r88523:88a7cf7c8142
Date: 2016-11-21 15:01 +0100
http://bitbucket.org/pypy/pypy/changeset/88a7cf7c8142/

Log:    Add an extra hint, which makes test_pypy_c pass
        test_exception:test_exception_inside_loop_1.

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
@@ -79,9 +79,14 @@
 
     def identifier_w(self, space):
         try:
-            # call the elidable function, with a jit.call_shortcut in case
-            # self._utf8 is already computed
-            identifier = g_identifier_w(self, space)
+            if jit.isconstant(self._value):
+                # constantly encode that unicode string; don't try
+                # to access the cache _utf8 at all
+                identifier = self._value.encode('utf-8')
+            else:
+                # call the elidable function, with a jit.call_shortcut in case
+                # self._utf8 is already computed
+                identifier = g_identifier_w(self, space)
         except UnicodeEncodeError:
             # bah, this is just to get an official app-level
             # UnicodeEncodeError
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to