Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

test twisted 21.7 #10402

Closed
wants to merge 10 commits into from
Next Next commit
switch from types.CoroutineType to typing.Coroutine
these should be identical semantically, and since `defer.ensureDeferred` is
defined to take a `typing.Coroutine`, will keep mypy happy
  • Loading branch information
richvdh committed Jul 21, 2021
commit 33d249f4b25fcdd5cef64b024397ab742a92afe7
4 changes: 2 additions & 2 deletions synapse/logging/context.py
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
import inspect
import logging
import threading
import types
import typing
import warnings
from typing import TYPE_CHECKING, Optional, Tuple, TypeVar, Union

@@ -745,7 +745,7 @@ def run_in_background(f, *args, **kwargs) -> defer.Deferred:
# by synchronous exceptions, so let's turn them into Failures.
return defer.fail()

if isinstance(res, types.CoroutineType):
if isinstance(res, typing.Coroutine):
res = defer.ensureDeferred(res)

# At this point we should have a Deferred, if not then f was a synchronous