Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In pallets#1995, typing was added to large parts of this project. This will be really useful to me. One of the problems I have with the latest release is `abort`. PyCharm doesn't know that `abort` aborts. So it will complain about possibly uninitialised variables if I write code like this: ``` if foo: bar = 1 else: abort(404) print(bar) ``` In master, `abort` now returns type `None`: `def abort(status: t.Union[int, "Response"], *args, **kwargs) -> None:` This type annotation means that the function returns `None`. This is not the case - I think `abort` always raises an exception. Instead, what we want to do is change the return type to [`t.NoReturn`](https://www.python.org/dev/peps/pep-0484/#the-noreturn-type). This expresses the correct meaning, which is that the `abort` function never returns. In turn, this will help PyCharm and other analysers understand code that uses `abort` better.
- Loading branch information