Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8c8a02a

Browse files
committed
speed up unquote() by using atoi() instead of eval()
1 parent 44a4d59 commit 8c8a02a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Lib/urllib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ def unquote(s):
645645
if j < 0:
646646
res = res + s[i:]
647647
break
648-
res = res + (s[i:j] + chr(eval('0x' + s[j+1:j+3])))
648+
res = res + (s[i:j] + chr(string.atoi(s[j+1:j+3], 16)))
649649
i = j+3
650650
return res
651651

0 commit comments

Comments
 (0)