You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please provide more information to help us understand the issue:
Are you reporting a bug, or opening a feature request? Bug
Please insert below the code you are checking with mypy,
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
What is the behavior/output you expect?
No error.
If the function has a Optional return type, then surely it does not need a return statement everywhere because it might return None, and not returning means it implicitly returns None
What are the versions of mypy and Python you are using? mypy 0.780, CPython 3.8.3
Do you see the same issue after installing mypy from Git master? Yes
What are the mypy flags you are using? (For example --strict-optional): None
By default, mypy will generate errors when a function is missing return statements in some execution paths. The only exceptions are when:
The function has a `None` or `Any` return type
The function has an empty body or a body that is just ellipsis (`...`). Empty functions are often used for abstract methods.
Passing in --no-warn-no-return will disable these error messages in all cases.
So an exception for Optional should be added too (and Unions that contain None).
The text was updated successfully, but these errors were encountered:
Please provide more information to help us understand the issue:
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
No error.
If the function has a Optional return type, then surely it does not need a return statement everywhere because it might return None, and not returning means it implicitly returns
None
Do you see the same issue after installing mypy from Git master? Yes
According to the docs:
So an exception for
Optional
should be added too (and Unions that contain None).The text was updated successfully, but these errors were encountered: