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

feat(types): adds support for Never and NoReturn from python Typing #5193

Merged
merged 3 commits into from
Jun 26, 2024

Conversation

InvincibleRMC
Copy link
Contributor

Description

Adds support for Never and NoReturn.

Allows support for annotating functions that do not return. It is typically used in superclass that do not implement functions.

class Foo:

   def func() -> Never:
         raise Exception()

   def func2() -> NoReturn:
         raise Exception()

class Bar(Foo):

    def func() -> int:
          return 3
    def func2() -> int:
          return 3

Suggested changelog entry:

  Adds support for `typing.Never` and `typing.NoReturn`.

@henryiii henryiii changed the title Adds support for Never and NoReturn from python Typing feat(types): adds support for Never and NoReturn from python Typing Jun 25, 2024
@henryiii henryiii merged commit 26281c7 into pybind:master Jun 26, 2024
83 of 84 checks passed
@github-actions github-actions bot added the needs changelog Possibly needs a changelog entry label Jun 26, 2024
@henryiii henryiii removed the needs changelog Possibly needs a changelog entry label Jun 26, 2024
@InvincibleRMC InvincibleRMC deleted the typing-no-return-never branch June 26, 2024 12:56
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