mirror of
https://github.com/python/cpython.git
synced 2024-11-27 20:04:41 +08:00
speed up unquote() by using atoi() instead of eval()
This commit is contained in:
parent
44a4d59b56
commit
8c8a02a258
@ -645,7 +645,7 @@ def unquote(s):
|
||||
if j < 0:
|
||||
res = res + s[i:]
|
||||
break
|
||||
res = res + (s[i:j] + chr(eval('0x' + s[j+1:j+3])))
|
||||
res = res + (s[i:j] + chr(string.atoi(s[j+1:j+3], 16)))
|
||||
i = j+3
|
||||
return res
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user