Skip to content
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

[mypyc] Compile away NewType type calls #14398

Merged

Conversation

ichard26
Copy link
Collaborator

@ichard26 ichard26 commented Jan 5, 2023

For example, here the call to ID is simply a no-op at runtime, returning 1 unchanged.

ID = NewType('ID', int)
person = ID(1)

Resolves mypyc/mypyc#958

For example, here the call to ID is simply a no-op at runtime,
returning 1 unchanged.

    ID = NewType('ID', int)
    person = ID(1)
Copy link
Collaborator

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

Thanks, this lgtm!

Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

looks good apart from the suggestion

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@JelleZijlstra JelleZijlstra merged commit ca66805 into python:master Jan 5, 2023
@ichard26 ichard26 deleted the compile-newtype-type-calls-away branch January 5, 2023 23:00
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.

Compile calls to NewType types into no-ops
4 participants