From 38460586cb652941398762faa742af652f14dbe9 Mon Sep 17 00:00:00 2001 From: Dong-hee Na Date: Sat, 1 May 2021 01:36:55 +0900 Subject: [PATCH 1/2] bpo-43979: Remove unnecessary operation from urllib.parse.parse_qsl --- Lib/urllib/parse.py | 3 +-- .../next/Library/2021-05-01-01-36-51.bpo-43979.43oJ9L.rst | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2021-05-01-01-36-51.bpo-43979.43oJ9L.rst 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..3e2593cff7afdd --- /dev/null +++ b/Misc/NEWS.d/next/Library/2021-05-01-01-36-51.bpo-43979.43oJ9L.rst @@ -0,0 +1,2 @@ +Remove the unnecessary operation from :func:`urllib.parse.parse_qsl`. +Patch by Christoph Zwerschke and Dong-hee Na. From 199ca6eb3405bcf3d3fc92127f7c2961d83fb0d5 Mon Sep 17 00:00:00 2001 From: "Gregory P. Smith" Date: Fri, 30 Apr 2021 11:39:40 -0700 Subject: [PATCH 2/2] minor NEWS wording update. --- .../next/Library/2021-05-01-01-36-51.bpo-43979.43oJ9L.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 index 3e2593cff7afdd..d5d1caa3e56827 100644 --- 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 @@ -1,2 +1,2 @@ -Remove the unnecessary operation from :func:`urllib.parse.parse_qsl`. -Patch by Christoph Zwerschke and Dong-hee Na. +Removed an unnecessary list comprehension before looping from +:func:`urllib.parse.parse_qsl`. Patch by Christoph Zwerschke and Dong-hee Na.