-
-
Notifications
You must be signed in to change notification settings - Fork 182
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Things to check first
-
I have searched the existing issues and didn't find my bug already reported there
-
I have checked that my bug is still present in the latest release
AnyIO version
4.12.0
Python version
3.13.8
What happened?
Hi. When decorating a method on a subclass, mypy raises an error. async_lru is fine with it.
How can we reproduce the bug?
import abc
from anyio.functools import lru_cache
from async_lru import alru_cache
class Iterface(abc.ABC):
@abc.abstractmethod
async def method(self, value: str) -> str: ...
class AnyIO(Iterface):
@lru_cache()
async def method(self, value: str) -> str: # error
return value
class AsyncLru(Iterface):
@alru_cache()
async def method(self, value: str) -> str:
return value
async def main() -> None:
anyio_value = await AnyIO().method("test") # error
async_lru_value = await AsyncLru().method("test")
assert anyio_value == async_lru_valuetest.py:14: error: Signature of "method" incompatible with supertype "Iterface" [override]
test.py:14: note: Superclass:
test.py:14: note: def method(self, value: str) -> Coroutine[Any, Any, str]
test.py:14: note: Subclass:
test.py:14: note: AsyncLRUCacheWrapper[[AnyIO, str], Any]
test.py:25: error: Missing positional argument "value" in call to "__call__" of "AsyncLRUCacheWrapper" [call-arg]
test.py:25: error: Argument 1 to "__call__" of "AsyncLRUCacheWrapper" has incompatible type "str"; expected "AnyIO" [arg-type]
mypy 1.18.2 (compiled: yes)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working