Author: Manuel Jacob <[email protected]>
Branch: py3.6
Changeset: r91914:73c89dbe9896
Date: 2017-07-17 20:47 +0200
http://bitbucket.org/pypy/pypy/changeset/73c89dbe9896/
Log: hg merge py3.5
diff --git a/pypy/objspace/std/bytesobject.py b/pypy/objspace/std/bytesobject.py
--- a/pypy/objspace/std/bytesobject.py
+++ b/pypy/objspace/std/bytesobject.py
@@ -748,14 +748,17 @@
if space.isinstance_w(w_source, space.w_unicode):
raise oefmt(space.w_TypeError,
"cannot convert a (unicode) str object to bytes")
+ return _from_byte_sequence(space, w_source)
- # sequence of bytes
+
+def _from_byte_sequence(space, w_source):
+ # Split off in a separate function for the JIT's benefit
w_result = space.appexec([w_source], """(seq):
result = bytearray()
for i in seq:
result.append(i)
return result""")
- return w_result.getdata()
+ return ''.join(w_result.getdata())
W_BytesObject.typedef = TypeDef(
"bytes", None, None, "read",
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit