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

Return type of twisted.internet.defer._ConcurrencyPrimitive.__aexit__ should be Deferred[Literal[False]] #11795

Closed
euresti opened this issue Jan 7, 2023 · 0 comments · Fixed by #11796
Labels

Comments

@euresti
Copy link
Contributor

euresti commented Jan 7, 2023

Describe the incorrect behavior you saw

I get lots of mypy errors (error: Missing return statement) when using DeferredLock

Describe how to cause this behavior

Run mypy on:

from twisted.internet.defer import DeferredLock

async def foo() -> int:
    lock = DeferredLock()
    async with lock:
        return 5

You'll get : foo.py:3: error: Missing return statement

Setting the return type to Literal[False] tells mypy that this context manager doesn't swallow exceptions.

Additional context
Add any other context about the problem here.

mypy 0.981 (compiled: yes)
Twisted==22.10.0

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

Successfully merging a pull request may close this issue.

1 participant