Message261059
It duplicates translated characters as well. For example:
>>> table = str.maketrans('mnopqrb', 'rqponm\u0100', 'a')
>>> 'aaaaaamnopqrb'.translate(table)
'rqponmrqponmĀ'
3.4 returns the correct result:
>>> table = str.maketrans('mnopqrb', 'rqponm\u0100', 'a')
>>> 'aaaaaamnopqrb'.translate(table)
'rqponmĀ'
The problem is the new fast path for one-to-one ASCII mapping (unicode_fast_translate in Objects/unicodeobject.c) doesn't have a way to return the current input position in order to resume processing the translation. _PyUnicode_TranslateCharmap assumes it's the same as the current writer position, which is wrong when input characters have been deleted. |
|
Date |
User |
Action |
Args |
2016-03-01 16:31:18 | eryksun | set | recipients:
+ eryksun, serhiy.storchaka, ben.knight |
2016-03-01 16:31:17 | eryksun | set | messageid: <1456849877.91.0.984298337253.issue26464@psf.upfronthosting.co.za> |
2016-03-01 16:31:17 | eryksun | link | issue26464 messages |
2016-03-01 16:31:17 | eryksun | create | |
|