Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion linter-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
black==19.10b0
flake8
flake8-import-order
mypy==0.761
mypy==0.770
flake8-bugbear>=19.8.0
pep8-naming
9 changes: 1 addition & 8 deletions sentry_sdk/integrations/excepthook.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,8 @@

from types import TracebackType

from mypy_extensions import Arg

Excepthook = Callable[
[
Arg(Type[BaseException], "type_"),
Arg(BaseException, "value"),
Arg(TracebackType, "traceback"),
],
None,
[Type[BaseException], BaseException, TracebackType], Any,
]


Expand Down
17 changes: 10 additions & 7 deletions sentry_sdk/integrations/tornado.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from sentry_sdk._compat import iteritems

try:
from tornado import version_info as TORNADO_VERSION
from tornado import version_info as TORNADO_VERSION # type: ignore
from tornado.web import RequestHandler, HTTPError
from tornado.gen import coroutine
except ImportError:
Expand Down Expand Up @@ -53,7 +53,7 @@ def setup_once():

ignore_logger("tornado.access")

old_execute = RequestHandler._execute
old_execute = RequestHandler._execute # type: ignore

awaitable = iscoroutinefunction(old_execute)

Expand All @@ -72,7 +72,8 @@ async def sentry_execute_request_handler(self, *args, **kwargs):
with Hub(hub) as hub:
with hub.configure_scope() as scope:
scope.clear_breadcrumbs()
scope.add_event_processor(_make_event_processor(weak_handler))
processor = _make_event_processor(weak_handler) # type: ignore
scope.add_event_processor(processor)
return await old_execute(self, *args, **kwargs)

else:
Expand All @@ -89,20 +90,22 @@ def sentry_execute_request_handler(self, *args, **kwargs):

with Hub(hub) as hub:
with hub.configure_scope() as scope:
scope.add_event_processor(_make_event_processor(weak_handler))
scope.clear_breadcrumbs()
processor = _make_event_processor(weak_handler) # type: ignore
scope.add_event_processor(processor)
result = yield from old_execute(self, *args, **kwargs)
return result

RequestHandler._execute = sentry_execute_request_handler
RequestHandler._execute = sentry_execute_request_handler # type: ignore

old_log_exception = RequestHandler.log_exception

def sentry_log_exception(self, ty, value, tb, *args, **kwargs):
# type: (Any, type, BaseException, Any, *Any, **Any) -> Optional[Any]
_capture_exception(ty, value, tb)
return old_log_exception(self, ty, value, tb, *args, **kwargs)
return old_log_exception(self, ty, value, tb, *args, **kwargs) # type: ignore

RequestHandler.log_exception = sentry_log_exception
RequestHandler.log_exception = sentry_log_exception # type: ignore


def _capture_exception(ty, value, tb):
Expand Down
2 changes: 1 addition & 1 deletion sentry_sdk/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def current_stacktrace(with_locals=True):
__tracebackhide__ = True
frames = []

f = sys._getframe()
f = sys._getframe() # type: Optional[FrameType]
while f is not None:
if not should_hide_frame(f):
frames.append(serialize_frame(f, with_locals=with_locals))
Expand Down