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

Regression in upcoming mypy 0.990 #82

Closed
arnimarj opened this issue Oct 29, 2022 · 3 comments · Fixed by #89
Closed

Regression in upcoming mypy 0.990 #82

arnimarj opened this issue Oct 29, 2022 · 3 comments · Fixed by #89

Comments

@arnimarj
Copy link
Contributor

Hi. I was testing the upcoming mypy release and it seems to be emitting new warning for interface definitions:

import zope.interface


class IZomething(zope.interface.Interface):
	def Query(a: str, b: str) -> list[int]:
		pass

gives:

$ mypy --config=mypy.ini int.py 
int.py:5: error: Missing return statement  [empty-body]
Found 1 error in 1 file (checked 1 source file)

Replacing the function body with ellipses silences the warning. Perhaps that should be the preferred way to define interfaces moving forward?

@arnimarj
Copy link
Contributor Author

arnimarj commented Nov 8, 2022

This is probably caused by python/mypy#13729

@kedder
Copy link
Member

kedder commented Nov 15, 2022

It doesn't seem like ellipses help here (I'm getting the same error if I replace pass with ...). And clearly we don't want these errors for zope interface methods. Trying to figure out the workaround.

@kedder
Copy link
Member

kedder commented Nov 15, 2022

That particular issue was easy to work around by explicitly marking interface methods as "abstract". However now mypy complains about not being able to instantiate abstract classes when we do "adaptation pattern". And there seem to be some deeper issue in mypy that prevents a "nice" solution for this right now. Filed python/mypy#14106, waiting or some response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants