Skip to content

Conversation

@ilevkivskyi
Copy link
Member

NoReturn was added to PEP 484 recently, and will be added to typing right after Python 3.6.1 release.

This PR allows to import NoReturn from typing in addition to mypy_extensions.

def f() -> NoReturn:
no_return()

x = 0 # type: NoReturn # E: Incompatible types in assignment (expression has type "int", variable has type NoReturn)
Copy link
Member

Choose a reason for hiding this comment

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

Does x = ... # type: NoReturn also produce an error?

Also, this error should happen even without --warn-no-return, so maybe it should be a separate test case.

Copy link
Member

Choose a reason for hiding this comment

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

Or even x: NoReturn

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right, --warn-no-return is now on by default, so that I just removed it.
x: NoReturn doesn't produce an error (and probably shouldn't) so I just use x: NoReturn = 0

@ilevkivskyi
Copy link
Member Author

python/typing#403 (comment)

Once this is out (inc. tags) we can merge #397 and #3041.

I think it is completely safe to merge this now (both typing PR, and peps PR are merged, and a new version of typing is released.)

@ilevkivskyi ilevkivskyi merged commit 8f68fa3 into python:master Mar 31, 2017
@ilevkivskyi ilevkivskyi deleted the typing-noreturn branch March 31, 2017 23:08
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