[Python-checkins] bpo-43979: Remove unnecessary operation from urllib.parse.parse_qsl (GH-25756)

miss-islington webhook-mailer at python.org
Fri Apr 30 15:02:06 EDT 2021


https://github.com/python/cpython/commit/6143fcdf8bfe54c24e3081bcee423f4d51f35c4e
commit: 6143fcdf8bfe54c24e3081bcee423f4d51f35c4e
branch: master
author: Dong-hee Na <donghee.na at python.org>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2021-04-30T12:01:55-07:00
summary:

bpo-43979: Remove unnecessary operation from urllib.parse.parse_qsl (GH-25756)



Automerge-Triggered-By: GH:gpshead

files:
A Misc/NEWS.d/next/Library/2021-05-01-01-36-51.bpo-43979.43oJ9L.rst
M Lib/urllib/parse.py

diff --git a/Lib/urllib/parse.py b/Lib/urllib/parse.py
index c11c695a741c8a..4249163f0edde7 100644
--- a/Lib/urllib/parse.py
+++ b/Lib/urllib/parse.py
@@ -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
index 00000000000000..d5d1caa3e56827
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2021-05-01-01-36-51.bpo-43979.43oJ9L.rst
@@ -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.



More information about the Python-checkins mailing list