Skip to content

Missing return statement after a call to quit() #6661

Closed

Description

@johnwspirent

I am getting "Missing return statement" with the following:

def foo() -> str:
try:
with open('bar.txt') as file:
return ''
except FileNotFoundError as error:
print(error)
quit()

Is this correct behaviour? (MyPy 0.670, Python 3.7.1)

Activity

  1. ilevkivskyi commented on Apr 11, 2019

    @ilevkivskyi
    Member

    This is a typeshed problem. quit() must be annotated with NoReturn, please open an issue there.

  2. johnwspirent commented on Apr 11, 2019

    @johnwspirent
    Author

    Ok. Will do. Thanks.

  3. johnwspirent commented on Apr 15, 2019

    @johnwspirent
    Author

    This has been fixed in typeshed now: #2912 via #2915.

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions