[pypy-commit] pypy unicode-utf8-py3: use unicode length, not utf8 length

mattip pypy.commits at gmail.com
Tue Oct 16 07:31:44 EDT 2018


Author: Matti Picus <matti.picus at gmail.com>
Branch: unicode-utf8-py3
Changeset: r95217:b9f98cb79846
Date: 2018-10-16 14:12 +0300
http://bitbucket.org/pypy/pypy/changeset/b9f98cb79846/

Log:	use unicode length, not utf8 length

diff --git a/pypy/module/cpyext/unicodeobject.py b/pypy/module/cpyext/unicodeobject.py
--- a/pypy/module/cpyext/unicodeobject.py
+++ b/pypy/module/cpyext/unicodeobject.py
@@ -72,7 +72,8 @@
 def unicode_attach(space, py_obj, w_obj, w_userdata=None):
     "Fills a newly allocated PyUnicodeObject with a unicode string"
     value = space.utf8_w(w_obj)
-    set_wsize(py_obj, len(value))
+    length = space.len_w(w_obj)
+    set_wsize(py_obj, length)
     set_wbuffer(py_obj, lltype.nullptr(rffi.CWCHARP.TO))
     _readify(space, py_obj, value)
 


More information about the pypy-commit mailing list