Skip to content

Commit

Permalink
avoid internal use of deprecated asyncio.iscoroutinefunction
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Jul 18, 2022
1 parent a4c0767 commit 5402f43
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Lib/asyncio/base_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import concurrent.futures
import functools
import heapq
import inspect
import itertools
import os
import socket
Expand Down Expand Up @@ -766,7 +767,7 @@ def call_soon(self, callback, *args, context=None):

def _check_callback(self, callback, method):
if (coroutines.iscoroutine(callback) or
coroutines.iscoroutinefunction(callback)):
inspect.iscoroutinefunction(callback)):
raise TypeError(
f"coroutines cannot be used with {method}()")
if not callable(callback):
Expand Down
3 changes: 2 additions & 1 deletion Lib/asyncio/unix_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import errno
import io
import inspect
import itertools
import os
import selectors
Expand Down Expand Up @@ -92,7 +93,7 @@ def add_signal_handler(self, sig, callback, *args):
Raise RuntimeError if there is a problem setting up the handler.
"""
if (coroutines.iscoroutine(callback) or
coroutines.iscoroutinefunction(callback)):
inspect.iscoroutinefunction(callback)):
raise TypeError("coroutines cannot be used "
"with add_signal_handler()")
self._check_signal(sig)
Expand Down
2 changes: 1 addition & 1 deletion Lib/unittest/mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import sys
import builtins
import pkgutil
from asyncio import iscoroutinefunction
from inspect import iscoroutinefunction
from types import CodeType, ModuleType, MethodType
from unittest.util import safe_repr
from functools import wraps, partial
Expand Down

0 comments on commit 5402f43

Please sign in to comment.