From df46b329e0900e9e4dc1d60816c1dce6dfc1094e Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Mon, 27 May 2019 16:00:14 -0400 Subject: [PATCH] Refs #30485 -- Avoided unnecessary instance checks in urlencode. Given doseq defaults to False it should avoid an unnecessary instance check in most cases. --- django/utils/http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/utils/http.py b/django/utils/http.py index d77bfb5992..b6a78184a6 100644 --- a/django/utils/http.py +++ b/django/utils/http.py @@ -116,7 +116,7 @@ def urlencode(query, doseq=False): 'Cannot encode None in a query string. Did you mean to pass ' 'an empty string or omit the value?' ) - elif isinstance(value, (str, bytes)) or not doseq: + elif not doseq or isinstance(value, (str, bytes)): query_val = value else: try: