Skip to content

Commit 8fb0dcb

Browse files
committed
Update asgiref to 3.11.0
1 parent f362076 commit 8fb0dcb

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

newrelic/packages/asgiref_compatibility.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@
3030
import 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+
3343
def 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

5565
def double_to_single_callable(application):

newrelic/packages/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
opentelemetry_proto==1.32.1
66
urllib3==2.6.2
77
wrapt==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

0 commit comments

Comments
 (0)