From 8cbd3df3ce75699cdc64d0d1bd903af43da43fa0 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Wed, 21 Dec 2016 12:59:28 +0200 Subject: Issue #28992: Use bytes.fromhex(). --- Lib/urllib/parse.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Lib/urllib/parse.py') diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py index 958767a08d..1d08730a89 100644 --- a/Lib/urllib/parse.py +++ b/Lib/urllib/parse.py @@ -574,7 +574,7 @@ def unquote_to_bytes(string): # if the function is never called global _hextobyte if _hextobyte is None: - _hextobyte = {(a + b).encode(): bytes([int(a + b, 16)]) + _hextobyte = {(a + b).encode(): bytes.fromhex(a + b) for a in _hexdig for b in _hexdig} for item in bits[1:]: try: -- cgit v1.2.1