Skip to content

Use functools.lru_cache in urllib.parse instead of 1996 custom caching #88168

Description

@gpshead
BPO 44002
Nosy @gpshead
PRs
  • bpo-44002: Switch to lru_cache in urllib.parse. #25798
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/gpshead'
    closed_at = <Date 2021-05-12.00:02:19.781>
    created_at = <Date 2021-05-01.18:17:15.725>
    labels = ['type-feature', 'library', '3.11']
    title = 'Use functools.lru_cache in urllib.parse instead of 1996 custom caching'
    updated_at = <Date 2021-05-12.00:02:19.781>
    user = 'https://github.com/gpshead'

    bugs.python.org fields:

    activity = <Date 2021-05-12.00:02:19.781>
    actor = 'gregory.p.smith'
    assignee = 'gregory.p.smith'
    closed = True
    closed_date = <Date 2021-05-12.00:02:19.781>
    closer = 'gregory.p.smith'
    components = ['Library (Lib)']
    creation = <Date 2021-05-01.18:17:15.725>
    creator = 'gregory.p.smith'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 44002
    keywords = ['patch']
    message_count = 3.0
    messages = ['392614', '392619', '392620']
    nosy_count = 1.0
    nosy_names = ['gregory.p.smith']
    pr_nums = ['25798']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'commit review'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue44002'
    versions = ['Python 3.11']

    Activity

    1. gpshead commented on May 1, 2021

      @gpshead
      MemberAuthor

      urllib.parse has custom caching code for both urlsplit() and quote(). 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.

    2. self-assigned this
      on May 1, 2021
    3. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      3.11only security fixes
      on May 1, 2021
    4. self-assigned this
      on May 1, 2021
    5. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      on May 1, 2021
    6. rhettinger commented on May 1, 2021

      @rhettinger
      Contributor

      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.

    7. gpshead commented on May 1, 2021

      @gpshead
      MemberAuthor

      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.

    8. transferred this issue fromon Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    Labels

    3.11only security fixesstdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions