File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed
Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 3030import inspect
3131
3232
33+ # Python 3.12 deprecates asyncio.iscoroutinefunction() as an alias for
34+ # inspect.iscoroutinefunction(), whilst also removing the _is_coroutine marker.
35+ # The latter is replaced with the inspect.markcoroutinefunction decorator.
36+ # Until 3.12 is the minimum supported Python version, provide a shim.
37+
38+ if hasattr (inspect , "iscoroutinefunction" ):
39+ iscoroutinefunction = inspect .iscoroutinefunction
40+ else :
41+ iscoroutinefunction = asyncio .iscoroutinefunction # type: ignore[assignment]
42+
3343def is_double_callable (application ):
3444 """
3545 Tests to see if an application is a legacy-style (double-callable) application.
@@ -46,10 +56,10 @@ def is_double_callable(application):
4656 if hasattr (application , "__call__" ):
4757 # We only check to see if its __call__ is a coroutine function -
4858 # if it's not, it still might be a coroutine function itself.
49- if asyncio . iscoroutinefunction (application .__call__ ):
59+ if iscoroutinefunction (application .__call__ ):
5060 return False
5161 # Non-classes we just check directly
52- return not asyncio . iscoroutinefunction (application )
62+ return not iscoroutinefunction (application )
5363
5464
5565def double_to_single_callable (application ):
Original file line number Diff line number Diff line change 55opentelemetry_proto == 1.32.1
66urllib3 == 2.6.2
77wrapt == 2.0.1
8- asgiref == 3.6 .0 # We only vendor asgiref.compatibility.py
8+ asgiref == 3.11 .0 # We only vendor asgiref.compatibility.py
You can’t perform that action at this time.
0 commit comments