Author: Ronan Lamy <[email protected]>
Branch: py3.6
Changeset: r96827:92c90687b29c
Date: 2019-06-18 19:33 +0100
http://bitbucket.org/pypy/pypy/changeset/92c90687b29c/

Log:    Optimise str(<int>): don't rescan a string that is known to always
        be ASCII

diff --git a/pypy/objspace/std/intobject.py b/pypy/objspace/std/intobject.py
--- a/pypy/objspace/std/intobject.py
+++ b/pypy/objspace/std/intobject.py
@@ -604,7 +604,7 @@
 
     def descr_repr(self, space):
         res = str(self.intval)
-        return space.newtext(res)
+        return space.newutf8(res, len(res))  # res is always ASCII
     descr_str = func_with_new_name(descr_repr, 'descr_str')
 
     def descr_format(self, space, w_format_spec):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to