Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix --warn-no-return for docstring only functions #2339

Merged
merged 1 commit into from
Oct 27, 2016

Conversation

ddfisher
Copy link
Collaborator

Currently functions like

def j() -> int:
  """docstring only"""

get a missing return statement note. They shouldn't.

@gvanrossum
Copy link
Member

I'm not sure I understand. The docstring doesn't return a value, it's equivalent to pass. Does a pass-only function also not need to have a return statement?

@ddfisher
Copy link
Collaborator Author

Yep, that's correct. Functions that are only pass or ellipses (with or without docstrings) don't need to have return statements.

@ddfisher
Copy link
Collaborator Author

I'd guess this is at least partially because --warn-no-return doesn't understand abstract methods and similar.

@gvanrossum
Copy link
Member

gvanrossum commented Oct 27, 2016 via email

@JukkaL
Copy link
Collaborator

JukkaL commented Oct 27, 2016

I added #2350 for the related issue of safe(r) checking of empty function bodies.

@ddfisher
Copy link
Collaborator Author

I'm for that. We'll still want this bugfix, though.

@gvanrossum gvanrossum merged commit 1ddca89 into master Oct 27, 2016
@gvanrossum gvanrossum deleted the warn-no-return-docstring branch October 27, 2016 22:36
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.

3 participants