File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import asyncio
1+ import sys
22from copy import deepcopy
33from functools import wraps
44
3232_DEFAULT_TRANSACTION_NAME = "generic FastAPI request"
3333
3434
35+ # Vendored: https://github.com/Kludex/starlette/blob/0a29b5ccdcbd1285c75c4fdb5d62ae1d244a21b0/starlette/_utils.py#L11-L17
36+ if sys .version_info >= (3 , 13 ): # pragma: no cover
37+ from inspect import iscoroutinefunction
38+ else :
39+ from asyncio import iscoroutinefunction
40+
41+
3542class FastApiIntegration (StarletteIntegration ):
3643 identifier = "fastapi"
3744
@@ -74,7 +81,7 @@ def _sentry_get_request_handler(*args: "Any", **kwargs: "Any") -> "Any":
7481 if (
7582 dependant
7683 and dependant .call is not None
77- and not asyncio . iscoroutinefunction (dependant .call )
84+ and not iscoroutinefunction (dependant .call )
7885 ):
7986 old_call = dependant .call
8087
Original file line number Diff line number Diff line change 1- import asyncio
21import functools
32import warnings
3+ import sys
44from collections .abc import Set
55from copy import deepcopy
66from json import JSONDecodeError
7474 multipart = None
7575
7676
77+ # Vendored: https://github.com/Kludex/starlette/blob/0a29b5ccdcbd1285c75c4fdb5d62ae1d244a21b0/starlette/_utils.py#L11-L17
78+ if sys .version_info >= (3 , 13 ): # pragma: no cover
79+ from inspect import iscoroutinefunction
80+ else :
81+ from asyncio import iscoroutinefunction
82+
83+
7784_DEFAULT_TRANSACTION_NAME = "generic Starlette request"
7885
7986TRANSACTION_STYLE_VALUES = ("endpoint" , "url" )
@@ -424,8 +431,8 @@ def _is_async_callable(obj: "Any") -> bool:
424431 while isinstance (obj , functools .partial ):
425432 obj = obj .func
426433
427- return asyncio . iscoroutinefunction (obj ) or (
428- callable (obj ) and asyncio . iscoroutinefunction (obj .__call__ )
434+ return iscoroutinefunction (obj ) or (
435+ callable (obj ) and iscoroutinefunction (obj .__call__ )
429436 )
430437
431438
You can’t perform that action at this time.
0 commit comments