2017-09-20 13 views
1

Pypy 대 pypy는 string.maketrans()를 인수 유니 때, 그러나 CPython과는 않습니다 처리하지 않는 것 :string.maketrans 유니 코드 처리 : CPython의

$ python 
Python 2.7.5 (default, Oct 11 2013, 14:51:32) 
[GCC 4.7.2] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import string 
>>> string.maketrans(ur"-/[] ", ur"_____") 
'\x00\x01\x02\x03\x04\x05\x06...' 
$ pypy 
Python 2.7.13 (c925e73810367cd960a32592dd7f728f436c125c, Jun 08 2017, 19:14:08) 
[PyPy 5.8.0 with GCC 6.3.0] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>>> import string 
>>>> string.maketrans(ur"-/[] ", ur"_____") 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File ".../pypy-5.8-linux_x86_64-portable/lib-python/2.7/string.py", line 78, in maketrans 
    buf[ord(fromstr[i])] = tostr[i] 
TypeError: 'unicode' object cannot be interpreted as an index 

는 내용을 찾지 못 하셨나요 http://pypy.readthedocs.io/en/latest/cpython_differences.html과 관련 있습니다.

이것은 CPython 또는 PyPy의 버그입니까?

답변