From d02d1406471fa1f94e3c89f6df927b35f73eae10 Mon Sep 17 00:00:00 2001 From: tetractius Date: Fri, 8 May 2020 19:59:21 +0100 Subject: [PATCH] [207] Added copy of dict - RuntimeError: dictionary keys changed during iteration --- rauth/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rauth/utils.py b/rauth/utils.py index b0b420a..0746b2d 100644 --- a/rauth/utils.py +++ b/rauth/utils.py @@ -23,7 +23,9 @@ def absolute_url(url): def parse_utf8_qsl(s): d = dict(parse_qsl(s)) - for k, v in d.items(): # pragma: no cover + copy_d = dict(d); + + for k, v in copy_d.items(): # pragma: no cover if not isinstance(k, bytes) and not isinstance(v, bytes): # skip this iteration if we have no keys or values to update continue @@ -36,6 +38,7 @@ def parse_utf8_qsl(s): return d + def get_sorted_params(params): def sorting_gen(): for k in sorted(params.keys()):