Skip to content

[mypyc] Avoid mutating the AST when processing singledispatch register calls #10779

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 1 commit into from
Jul 7, 2021

Conversation

pranavrajpal
Copy link
Contributor

This PR makes mypyc avoid mutating the AST while searching decorators for any singledispatch register calls, as requested in #10753 (comment).

Instead of modifying dec.decorators directly, copy it and only modify
the copied version. That prevents us from modifying the AST in mypyc,
which we should avoid according to
python#10753 (comment).
@pranavrajpal pranavrajpal changed the title Avoid mutating the AST when processing singledispatch register calls [mypyc] Avoid mutating the AST when processing singledispatch register calls Jul 7, 2021
Copy link
Collaborator

@msullivan msullivan left a comment

Choose a reason for hiding this comment

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

Great!

@msullivan msullivan merged commit e6b5949 into python:master Jul 7, 2021
@pranavrajpal pranavrajpal deleted the avoid-ast-mutation-in-mypyc branch July 7, 2021 05:13
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