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] Support ellipsis (...) expressions in class bodies #17923

Merged
merged 3 commits into from
Oct 14, 2024

Conversation

Newbytee
Copy link
Contributor

This can be used to declare concise custom exceptions, e.g.

class UnknownReleaseError(ValueError): ...

which otherwise probably would be written

class UnknownReleaseError(ValueError):
    pass

and is supported by CPython.

Closes mypyc/mypyc#1069

Copy link
Collaborator

@JukkaL JukkaL left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Some minor things, looks good overall.

mypyc/irbuild/classdef.py Outdated Show resolved Hide resolved
@Newbytee Newbytee force-pushed the ellipsis-class branch 2 times, most recently from ac44b60 to 3400896 Compare October 11, 2024 19:15
This can be used to declare concise custom exceptions, e.g.

    class UnknownReleaseError(ValueError): ...

which otherwise probably would be written

    class UnknownReleaseError(ValueError):
        pass

and is supported by CPython.

Closes mypyc/mypyc#1069
@Newbytee Newbytee requested a review from JukkaL October 12, 2024 11:10
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.

Thank you!

@JukkaL JukkaL merged commit 395108d into python:master Oct 14, 2024
13 checks passed
@Newbytee Newbytee deleted the ellipsis-class branch October 14, 2024 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Doesn't understand empty class bodies with an ellipsis instead of "pass"
3 participants