[issue44002] Use functools.lru_cache in urllib.parse instead of 1996 custom caching

2021-05-11 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
resolution:  -> fixed
stage: patch review -> commit review
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44002] Use functools.lru_cache in urllib.parse instead of 1996 custom caching

2021-05-01 Thread Gregory P. Smith


Change by Gregory P. Smith :


--
keywords: +patch
pull_requests: +24486
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/25798

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44002] Use functools.lru_cache in urllib.parse instead of 1996 custom caching

2021-05-01 Thread Gregory P. Smith


Gregory P. Smith  added the comment:

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.

--
nosy:  -rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44002] Use functools.lru_cache in urllib.parse instead of 1996 custom caching

2021-05-01 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

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.

--
nosy: +rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44002] Use functools.lru_cache in urllib.parse instead of 1996 custom caching

2021-05-01 Thread Gregory P. Smith


New submission from Gregory P. Smith :

`urllib.parse` has custom caching code for both `urlsplit()` and `quote()`.  
From 1996.

https://github.com/python/cpython/commit/3fd32ecd9232fcb041b9f1f7a19a1e7e65cf11a0
https://github.com/python/cpython/commit/74495409861b357d9925937d6576229c74e2550d

with a truthful comment added by Nick in 2010 that we should just use 
functools.lru_cache.

https://github.com/python/cpython/commit/9fc443cf590c76d4b979c46dc954d3956cee0319#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.

--
assignee: gregory.p.smith
components: Library (Lib)
messages: 392614
nosy: gregory.p.smith
priority: normal
severity: normal
status: open
title: Use functools.lru_cache in urllib.parse instead of 1996 custom caching
type: enhancement
versions: Python 3.11

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com