diff --git a/synapse/logging/context.py b/synapse/logging/context.py
index 64c6ae4512..bf7e311026 100644
--- a/synapse/logging/context.py
+++ b/synapse/logging/context.py
@@ -728,7 +728,7 @@ async def _unwrap_awaitable(awaitable: Awaitable[R]) -> R:
@overload
-def preserve_fn( # type: ignore[misc]
+def preserve_fn(
f: Callable[P, Awaitable[R]],
) -> Callable[P, "defer.Deferred[R]"]:
# The `type: ignore[misc]` above suppresses
@@ -756,7 +756,7 @@ def preserve_fn(
@overload
-def run_in_background( # type: ignore[misc]
+def run_in_background(
f: Callable[P, Awaitable[R]], *args: P.args, **kwargs: P.kwargs
) -> "defer.Deferred[R]":
# The `type: ignore[misc]` above suppresses
diff --git a/synapse/logging/opentracing.py b/synapse/logging/opentracing.py
index 5c3045e197..4454fe29a5 100644
--- a/synapse/logging/opentracing.py
+++ b/synapse/logging/opentracing.py
@@ -991,11 +991,7 @@ def trace_with_opname(
if not opentracing:
return func
- # type-ignore: mypy seems to be confused by the ParamSpecs here.
- # I think the problem is https://github.com/python/mypy/issues/12909
- return _custom_sync_async_decorator(
- func, _wrapping_logic # type: ignore[arg-type]
- )
+ return _custom_sync_async_decorator(func, _wrapping_logic)
return _decorator
@@ -1040,9 +1036,7 @@ def tag_args(func: Callable[P, R]) -> Callable[P, R]:
set_tag(SynapseTags.FUNC_KWARGS, str(kwargs))
yield
- # type-ignore: mypy seems to be confused by the ParamSpecs here.
- # I think the problem is https://github.com/python/mypy/issues/12909
- return _custom_sync_async_decorator(func, _wrapping_logic) # type: ignore[arg-type]
+ return _custom_sync_async_decorator(func, _wrapping_logic)
@contextlib.contextmanager
|