Skip to content

[mypyc] Treat callable environment links as final - #21956

Merged
JukkaL merged 3 commits into
masterfrom
mypyc-async-5b
Sep 8, 2026
Merged

[mypyc] Treat callable environment links as final#21956
JukkaL merged 3 commits into
masterfrom
mypyc-async-5b

Conversation

@JukkaL

@JukkaL JukkaL commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator

This allows faster attribute init and read ops to be used on free-threaded builds.

I checked that this made a trivial microbenchmark that uses a nested function about 1.3x faster on Python 3.14 (free-threaded).

Comment on lines +1360 to +1365
try:
fn.__mypyc_env__ = None
except AttributeError:
pass
else:
assert False

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.

could use assertRaises

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.

I'll do this in a follow-up PR that is closely related to this PR.

@JukkaL
JukkaL merged commit 561f563 into master Sep 8, 2026
18 checks passed
@JukkaL
JukkaL deleted the mypyc-async-5b branch September 8, 2026 10:45
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