You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use functools.lru_cache in urllib.parse instead of 1996 custom caching #88168
I'm waiting for after the 3.10 cut and a still in progress urllib.parse security fix to land before rebasing my soon to be attached PR to avoid code conflicts.
While you're cleaning up the module, take a look at the Quoter class. It overrides __init__ and __missing__, so Quoter is not using any of the defaultdict features at all. I'm thinking it could just inherit from dict.
Past notes of some the caching performance around the character quoting for quote() can be found in https://bugs.python.org/issue1285086 circa 2005-2010.
Activity
gpshead commentedon May 1, 2021
urllib.parsehas custom caching code for bothurlsplit()andquote(). From 1996.3fd32ec
7449540
with a truthful comment added by Nick in 2010 that we should just use functools.lru_cache.
9fc443c#diff-b3712475a413ec972134c0260c8f1eb1deefb66184f740ef00c37b4487ef873e
time to clean up this cruft and do that.
I'm waiting for after the 3.10 cut and a still in progress urllib.parse security fix to land before rebasing my soon to be attached PR to avoid code conflicts.
rhettinger commentedon May 1, 2021
While you're cleaning up the module, take a look at the Quoter class. It overrides __init__ and __missing__, so Quoter is not using any of the defaultdict features at all. I'm thinking it could just inherit from dict.
gpshead commentedon May 1, 2021
Yeah, the Quoter class seems a little odd...
Past notes of some the caching performance around the character quoting for quote() can be found in https://bugs.python.org/issue1285086 circa 2005-2010.