Skip to content

Commit 5402f43

Browse files
committed
avoid internal use of deprecated asyncio.iscoroutinefunction
1 parent a4c0767 commit 5402f43

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

Lib/asyncio/base_events.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import concurrent.futures
1919
import functools
2020
import heapq
21+
import inspect
2122
import itertools
2223
import os
2324
import socket
@@ -766,7 +767,7 @@ def call_soon(self, callback, *args, context=None):
766767

767768
def _check_callback(self, callback, method):
768769
if (coroutines.iscoroutine(callback) or
769-
coroutines.iscoroutinefunction(callback)):
770+
inspect.iscoroutinefunction(callback)):
770771
raise TypeError(
771772
f"coroutines cannot be used with {method}()")
772773
if not callable(callback):

Lib/asyncio/unix_events.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import errno
44
import io
5+
import inspect
56
import itertools
67
import os
78
import selectors
@@ -92,7 +93,7 @@ def add_signal_handler(self, sig, callback, *args):
9293
Raise RuntimeError if there is a problem setting up the handler.
9394
"""
9495
if (coroutines.iscoroutine(callback) or
95-
coroutines.iscoroutinefunction(callback)):
96+
inspect.iscoroutinefunction(callback)):
9697
raise TypeError("coroutines cannot be used "
9798
"with add_signal_handler()")
9899
self._check_signal(sig)

Lib/unittest/mock.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import sys
3232
import builtins
3333
import pkgutil
34-
from asyncio import iscoroutinefunction
34+
from inspect import iscoroutinefunction
3535
from types import CodeType, ModuleType, MethodType
3636
from unittest.util import safe_repr
3737
from functools import wraps, partial

0 commit comments

Comments
 (0)