gh-118013: Use weakrefs for the cache key in `inspect._shadowed_dict` by AlexWaygood · Pull Request #118202 · python/cpython · GitHub

github.com

Tin mới

AlexWaygood:inspect-weakref-cache-key

miss-islington-app

GitHub CopilotWrite better code with AI

GitHub Copilot appDirect agents from issue to merge

ActionsAutomate any workflow

CodespacesInstant dev environments

IssuesPlan and track work

Code ReviewManage code changes

Code QualityEnforce quality at merge

GitHub Advanced SecurityFind and fix vulnerabilities

Code securitySecure your code as you build

Secret protectionStop leaks before they start

View all use cases

Financial services

View all industries

Software Development

GitHub SponsorsFund open source developers

Copilot for BusinessEnterprise-grade AI features

Premium SupportEnterprise-grade 24/7 support

Pull requests 2.6k

Security and quality 0

[3.12] getattr_static can result in reference leaks #118013

Merge branch 'main' into inspect-weakref-cache-key

View reviewed changes

Learn more about hiding disruptive comments

The reason will be displayed to describe this comment to others. Learn more.

Tests and comments

Clear the cache anyway after running test_inspect, for extra safety

awaiting core review

awaiting core review

Merge branch 'main' into inspect-weakref-cache-key

getattr_static benchmarks:

All timings done with a fresh PGO-optimised build on main using a MacBook pro.

needs backport to 3.12

needs backport to 3.12

View reviewed changes

: Use weakrefs for the cache key in `inspect._shadowed…

bedevere-app Bot commented Apr 24, 2024

bedevere-app Bot commented Apr 24, 2024

GH-118232 is a backport of this pull request to the 3.12 branch.

[3.12] gh-118013: Use weakrefs for the cache key in `inspect._shadowed_dict` (GH-118202) (#118232) Co-authored-by: Alex Waygood <[email protected]>

Understand the outlier benchmarks on 3.14 (main) vs. 3.13.0 faster-cpython/ideas#726