]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43979: Remove unnecessary operation from urllib.parse.parse_qsl (GH-25756)
authorDong-hee Na <donghee.na@python.org>
Fri, 30 Apr 2021 19:01:55 +0000 (04:01 +0900)
committerGitHub <noreply@github.com>
Fri, 30 Apr 2021 19:01:55 +0000 (12:01 -0700)
Automerge-Triggered-By: GH:gpshead
Lib/urllib/parse.py
Misc/NEWS.d/next/Library/2021-05-01-01-36-51.bpo-43979.43oJ9L.rst [new file with mode: 0644]

index c11c695a741c8aac38b82579f98072e4fce0d67f..4249163f0edde7c82bcbe2dd9b19c4231e007c4b 100644 (file)
@@ -752,9 +752,8 @@ def parse_qsl(qs, keep_blank_values=False, strict_parsing=False,
         if max_num_fields < num_fields:
             raise ValueError('Max number of fields exceeded')
 
-    pairs = [s1 for s1 in qs.split(separator)]
     r = []
-    for name_value in pairs:
+    for name_value in qs.split(separator):
         if not name_value and not strict_parsing:
             continue
         nv = name_value.split('=', 1)
diff --git a/Misc/NEWS.d/next/Library/2021-05-01-01-36-51.bpo-43979.43oJ9L.rst b/Misc/NEWS.d/next/Library/2021-05-01-01-36-51.bpo-43979.43oJ9L.rst
new file mode 100644 (file)
index 0000000..d5d1caa
--- /dev/null
@@ -0,0 +1,2 @@
+Removed an unnecessary list comprehension before looping from
+:func:`urllib.parse.parse_qsl`.  Patch by Christoph Zwerschke and Dong-hee Na.