Author: Matti Picus <[email protected]>
Branch: unicode-utf8
Changeset: r95516:72d83a806c67
Date: 2018-12-20 13:25 +0200
http://bitbucket.org/pypy/pypy/changeset/72d83a806c67/

Log:    fast path for unicode, also raises on non-ascii strings

diff --git a/pypy/interpreter/baseobjspace.py b/pypy/interpreter/baseobjspace.py
--- a/pypy/interpreter/baseobjspace.py
+++ b/pypy/interpreter/baseobjspace.py
@@ -1671,6 +1671,8 @@
         # needed because CPython has the same issue.  (Well, it's
         # unclear if there is any use at all for getting the bytes in
         # the unicode buffer.)
+        if self.isinstance_w(w_obj, self.w_unicode):
+            return w_obj.charbuf_w(self)
         try:
             return self.bytes_w(w_obj)
         except OperationError as e:
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to