diff --git a/README.md b/README.md index 3ee5763..b862456 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,28 @@ tedious. The `signature-mutators` directive will globally disable the signature-checking for `aioretry()` and `retry()` calls, so this can be easier depending of your own usage of kaioretry.) +## Mypy and functions generated by kaioretry.aioretry + +[Mypy](https://github.com/python/mypy) may incorrectly infer the type of an +aioretry-decorated function as `def (*Any, **Any) -> Any` *if* the original +function: + +1. is a coroutine _and_ +2. has a returned type hinted as `Any` and/or if parameters are hinted as `Any`. + +If the original function is fully annotated as non-`Any`, the resulting +decorated function annotations should be correctly inferred (according to +[kaioretry test](/Anvil/kaioretry/main/test/static_analysis). + +It is unclear to me right now, if the `kaioretry.aioretry` function type hints +are incorrect or if it is an issue with either mypy or cpython. Or both. Or +all 3. Go figure. + +Any information on that matter would be greatly appreciated. I've spent weeks +trying to track down this issue. And while walking down this path has allowed +me to fix some other (rather unrelated) type-hinting boo-boos from my part, +this very specific issue is still puzzling me. + # Feedback welcome. Always.