GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Correct reuse argument tuple in property descriptor · Issue #68464 · python/cpython

Correct reuse argument tuple in property descriptor #68464

New issue
Copy link
New issue
Copy link
Closed
Closed
Correct reuse argument tuple in property descriptor#68464
Copy link
Assignees
serhiy-storchaka
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump

Description

@serhiy-storchaka
serhiy-storchaka
opened on May 24, 2015
Issue body actions
BPO 24276
Nosy @warsaw, @rhettinger, @ericvsmith, @ericsnowcurrently, @serhiy-storchaka, @llllllllll
Files
  • property_cached_args.patch
  • 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/serhiy-storchaka'
    closed_at = <Date 2015-05-24.20:32:03.648>
    created_at = <Date 2015-05-24.13:11:49.739>
    labels = ['interpreter-core', 'type-crash']
    title = 'Correct reuse argument tuple in property descriptor'
    updated_at = <Date 2015-05-24.20:32:03.648>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2015-05-24.20:32:03.648>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2015-05-24.20:32:03.648>
    closer = 'serhiy.storchaka'
    components = ['Interpreter Core']
    creation = <Date 2015-05-24.13:11:49.739>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['39482']
    hgrepos = []
    issue_num = 24276
    keywords = ['patch']
    message_count = 5.0
    messages = ['243980', '243983', '243992', '243993', '243998']
    nosy_count = 7.0
    nosy_names = ['barry', 'rhettinger', 'eric.smith', 'python-dev', 'eric.snow', 'serhiy.storchaka', 'llllllllll']
    pr_nums = []
    priority = 'high'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'crash'
    url = 'https://bugs.python.org/issue24276'
    versions = ['Python 3.5']

    Activity

    1. serhiy-storchaka commented on May 24, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on May 24, 2015
      MemberAuthor
      More actions

      Property descriptor getter uses cached tuple for args (bpo-23910). This can cause problems when called function use args after reading other property or save args. For now I know only one example - clru_cache_3.patch in bpo-14373.

      Proposed patch use cached tuple in more robust manner.

    2. serhiy-storchaka
      added
      interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
      type-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
      on May 24, 2015
    3. serhiy-storchaka commented on May 24, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on May 24, 2015
      MemberAuthor
      More actions

      Affect on performance:

      $ ./python -m timeit -r 11 -s "from collections import namedtuple as n;a = n('n', 'a b c')(1, 2, 3)"

      Unpatched: 10000000 loops, best of 11: 0.0567 usec per loop
      Patched : 10000000 loops, best of 11: 0.0567 usec per loop

    4. rhettinger commented on May 24, 2015

      @rhettinger
      rhettinger
      on May 24, 2015
      Contributor
      More actions

      LGTM, go ahead and apply.

    5. rhettinger
      assigned
      serhiy-storchaka
      on May 24, 2015
    6. serhiy-storchaka commented on May 24, 2015

      @serhiy-storchaka
      serhiy-storchaka
      on May 24, 2015
      MemberAuthor
      More actions

      Sorry, it was incorrect microbenchmark. Correct is:

      $ ./python -m timeit -r 11 -s "from collections import namedtuple as n;a = n('n', 'a b c')(1, 2, 3)" -- "a.a"
      3.4          : 1000000 loops, best of 11: 0.601 usec per loop
      3.5 unpatched: 1000000 loops, best of 11: 0.445 usec per loop
      3.5 patched  : 1000000 loops, best of 11: 0.454 usec per loop

      There is small slowdown (2%), but it is only small part of the gain of the optimization.

    7. python-dev commented on May 24, 2015

      @python-dev
      python-devmannequin
      on May 24, 2015
      Mannequin
      More actions

      New changeset 5dbf3d932a59 by Serhiy Storchaka in branch 'default':
      Issue bpo-24276: Fixed optimization of property descriptor getter.
      https://hg.python.org/cpython/rev/5dbf3d932a59

    8. serhiy-storchaka
      closed this as completedon May 24, 2015
    9. ezio-melotti
      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

    • @serhiy-storchaka
      serhiy-storchaka

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.