Skip to content

Commit d226d31

Browse files
Merge branch 'webb/test-ci-3' of github.com:getsentry/sentry-python into webb/test-ci-3
2 parents 3530c60 + b63ef99 commit d226d31

5 files changed

Lines changed: 12 additions & 9 deletions

File tree

sentry_sdk/integrations/_wsgi_common.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99

1010
try:
1111
from django.http.request import RawPostDataException
12+
13+
_RAW_DATA_EXCEPTIONS = (RawPostDataException, ValueError)
1214
except ImportError:
1315
RawPostDataException = None
16+
_RAW_DATA_EXCEPTIONS = (ValueError,)
1417

1518
from typing import TYPE_CHECKING
1619

@@ -110,7 +113,7 @@ def extract_into_event(self, event: "Event") -> None:
110113
raw_data = None
111114
try:
112115
raw_data = self.raw_data()
113-
except (RawPostDataException, ValueError):
116+
except _RAW_DATA_EXCEPTIONS:
114117
# If DjangoRestFramework is used it already read the body for us
115118
# so reading it here will fail. We can ignore this.
116119
pass
@@ -175,7 +178,7 @@ def json(self) -> "Optional[Any]":
175178

176179
try:
177180
raw_data = self.raw_data()
178-
except (RawPostDataException, ValueError):
181+
except _RAW_DATA_EXCEPTIONS:
179182
# The body might have already been read, in which case this will
180183
# fail
181184
raw_data = None

sentry_sdk/integrations/django/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ class DjangoIntegration(Integration):
120120
origin_db = f"auto.db.{identifier}"
121121

122122
transaction_style = ""
123-
middleware_spans = None
124-
signals_spans = None
125-
cache_spans = None
123+
middleware_spans: "Optional[bool]" = None
124+
signals_spans: "Optional[bool]" = None
125+
cache_spans: "Optional[bool]" = None
126126
signals_denylist: "list[signals.Signal]" = []
127127

128128
def __init__(

sentry_sdk/integrations/django/asgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
iscoroutinefunction = inspect.iscoroutinefunction
4545
markcoroutinefunction = inspect.markcoroutinefunction
4646
else:
47-
iscoroutinefunction = asyncio.iscoroutinefunction # type: ignore[assignment]
47+
iscoroutinefunction = asyncio.iscoroutinefunction
4848

4949
def markcoroutinefunction(func: "_F") -> "_F":
5050
func._is_coroutine = asyncio.coroutines._is_coroutine # type: ignore

sentry_sdk/integrations/gnu_backtrace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@
1616
FUNCTION_RE = r"[^@]+?"
1717
HEX_ADDRESS = r"\s+@\s+0x[0-9a-fA-F]+"
1818

19-
FRAME_RE = r"""
19+
_FRAME_RE_PATTERN = r"""
2020
^(?P<index>\d+)\.\s+(?P<function>{FUNCTION_RE}){HEX_ADDRESS}(?:\s+in\s+(?P<package>.+))?$
2121
""".format(
2222
FUNCTION_RE=FUNCTION_RE,
2323
HEX_ADDRESS=HEX_ADDRESS,
2424
)
2525

26-
FRAME_RE = re.compile(FRAME_RE, re.MULTILINE | re.VERBOSE)
26+
FRAME_RE = re.compile(_FRAME_RE_PATTERN, re.MULTILINE | re.VERBOSE)
2727

2828

2929
class GnuBacktraceIntegration(Integration):

sentry_sdk/integrations/starlette.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ def _is_async_callable(obj: "Any") -> bool:
475475
obj = obj.func
476476

477477
return iscoroutinefunction(obj) or (
478-
callable(obj) and iscoroutinefunction(obj.__call__)
478+
callable(obj) and iscoroutinefunction(obj.__call__) # type: ignore[operator]
479479
)
480480

481481

0 commit comments

Comments
 (0)