Skip to content

Commit

Permalink
Merge pull request #3136 from graingert/remove-unreachable-if-asyncio…
Browse files Browse the repository at this point in the history
…-checks

remove unreachable asyncio checks
  • Loading branch information
bdarnell committed Jun 7, 2022
2 parents a9df6aa + 5147776 commit 2642ede
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions tornado/ioloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,12 @@ async def main():
def configure(
cls, impl: "Union[None, str, Type[Configurable]]", **kwargs: Any
) -> None:
if asyncio is not None:
from tornado.platform.asyncio import BaseAsyncIOLoop

if isinstance(impl, str):
impl = import_object(impl)
if isinstance(impl, type) and not issubclass(impl, BaseAsyncIOLoop):
raise RuntimeError(
"only AsyncIOLoop is allowed when asyncio is available"
)
from tornado.platform.asyncio import BaseAsyncIOLoop

if isinstance(impl, str):
impl = import_object(impl)
if isinstance(impl, type) and not issubclass(impl, BaseAsyncIOLoop):
raise RuntimeError("only AsyncIOLoop is allowed when asyncio is available")
super(IOLoop, cls).configure(impl, **kwargs)

@staticmethod
Expand Down Expand Up @@ -323,8 +320,6 @@ def _clear_current() -> None:
old = IOLoop.current(instance=False)
if old is not None:
old._clear_current_hook()
if asyncio is None:
IOLoop._current.instance = None

def _clear_current_hook(self) -> None:
"""Instance method called when an IOLoop ceases to be current.
Expand Down

0 comments on commit 2642ede

Please sign in to comment.