Skip to content

0.990 reports error for function with body that is just ellipsis #14048

Description

@haxtibal

mypy 0.990 (python 3.8) reports an error for the following source code

def foo() -> int:
    ...
$ mypy foo.py 
/tmp/foo.py:1: error: Missing return statement  [empty-body]
Found 1 error in 1 file (checked 1 source file)

mypy 0.981 would let the same code pass. Was that an intended change in between, or a regression?

From mypy CLI documentation

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.

I'd expect Success for the given example, because the 2nd exception ("body that is just ellipsis") applies.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions