From 507c5df984b8ff271b14e3fe222a9ce074cce884 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Sun, 29 Oct 2017 22:11:05 +0000 Subject: [PATCH] [#3112|Console] Fix handling hex for setting peer_tos in config The token parser was converting hex value to int which is not what should be passed onto libtorrent peer_tos setting. --- deluge/ui/console/cmdline/commands/config.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deluge/ui/console/cmdline/commands/config.py b/deluge/ui/console/cmdline/commands/config.py index f3f9dfefa..dae25ee4f 100644 --- a/deluge/ui/console/cmdline/commands/config.py +++ b/deluge/ui/console/cmdline/commands/config.py @@ -39,7 +39,11 @@ def atom(src, token): if token[1] == '-': return int(token[-1], 0) else: - return int(token[1], 0) + if token[1].startswith('0x'): + # Hex number so return unconverted as string. + return token[1].decode('string-escape') + else: + return int(token[1], 0) except ValueError: try: return float(token[-1])