Commit 3b7128c1 authored by Kirill Smelkov's avatar Kirill Smelkov

X patch builtin str/unicode

Needs cython@ed7c54e9.
parent 513be11e
This diff is collapsed.
...@@ -2498,7 +2498,7 @@ def bench_bencode(b): ...@@ -2498,7 +2498,7 @@ def bench_bencode(b):
# xbytes/xunicode/xbytearray convert provided bytes/unicode object to bytes, # xbytes/xunicode/xbytearray convert provided bytes/unicode object to bytes,
# unicode or bytearray correspondingly to function name. # unicode or bytearray correspondingly to function name.
def xbytes(x): return x.encode('utf-8') if type(x) is unicode else x def xbytes(x): return _bdata(x.encode('utf-8') if type(x) is unicode else x)
def xunicode(x): return x.decode('utf-8') if type(x) is bytes else x def xunicode(x): return x.decode('utf-8') if type(x) is bytes else x
def xbytearray(x): return bytearray(xbytes(x)) def xbytearray(x): return bytearray(xbytes(x))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment