8000 gh-118013: Use weakrefs for the cache key in `inspect._shadowed_dict` by AlexWaygood · Pull Request #118202 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-118013: Use weakrefs for the cache key in inspect._shadowed_dict #118202

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Apr 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wip
  • Loading branch information
AlexWaygood committed Apr 23, 2024
commit 57da345a8d904705e82b141ef8a69f28cf60c634
4 changes: 2 additions & 2 deletions Lib/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -1835,7 +1835,7 @@ def _check_class(klass, attr):


@functools.lru_cache()
def _shadowed_dict_from_weakref_mro_tuple(weakref_mro):
def _shadowed_dict_from_weakref_mro_tuple(*weakref_mro):
for weakref_entry in weakref_mro:
entry = weakref_entry()
dunder_dict = _get_dunder_dict_of_class(entry)
Expand All @@ -1850,7 +1850,7 @@ def _shadowed_dict_from_weakref_mro_tuple(weakref_mro):

def _shadowed_dict(klass):
return _shadowed_dict_from_weakref_mro_tuple(
tuple([weakref.ref(entry) for entry in _static_getmro(klass)])
*[weakref.ref(entry) for entry in _static_getmro(klass)]
)


Expand Down
0