gh-157621: Clear weakrefs for ParamSpec attributes - #157622
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
|
Thanks @GruffElixir for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15. |
|
GH-157653 is a backport of this pull request to the 3.15 branch. |
|
GH-157654 is a backport of this pull request to the 3.14 branch. |
|
GH-157655 is a backport of this pull request to the 3.13 branch. |
Fixes #157621.
ParamSpec.argsand.kwargsuseparamspecattr_dealloc, which freed the instance without clearing its weakrefs. Clear them before freeing the object, matching the other type-parameter deallocators.Adds a regression test for both attributes that checks the weakref callback runs and the reference is cleared.
Validation:
PCbuild/build.bat -d -qPCbuild/amd64/python_d.exe -m test -v test_typing(742 tests)