Skip to content

[mypyc] Fix reference leaks of temporaries in singledispatch registration - #22245

Merged
p-sawicki merged 1 commit into
python:masterfrom
p-sawicki:misc_ops-fix-singledispatch-crashes
Oct 21, 2026
Merged

p-sawicki merged 1 commit into
python:masterfrom
p-sawicki:misc_ops-fix-singledispatch-crashes

Conversation

@p-sawicki

Copy link
Copy Markdown
Collaborator

Release temporary objects created in the register function both on success and failure. Add null checks to fix crash when type hints are not available.

[file driver.py]
import register

[case testRegisterAnnotationErrorOwnership]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Run tests are quite expensive run each, and singledispatch is a pretty rarely used feature. Can you merge some of these tests in a follow-up PR so that each [case ...] has multiple test_* functions, as this will be more efficient? (No need to merge everything into one case, but more like reduce the number of distinct cases by a decent number where they are easy to merge.)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ok will prepare a follow-up

@p-sawicki
p-sawicki merged commit 8b710b2 into python:master Oct 21, 2026
18 checks passed
@p-sawicki
p-sawicki deleted the misc_ops-fix-singledispatch-crashes branch October 21, 2026 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants