From df0119bb295040d70a1c56ed25ef995345f3e483 Mon Sep 17 00:00:00 2001 From: Kevin Ji <1146876+kevinji@users.noreply.github.com> Date: Wed, 11 Dec 2024 14:17:25 -0800 Subject: [PATCH 1/2] tbtools: Fix typing of `current` This preps for a typing fix in python/typeshed#13231 where `__cause__` and `__context__` can be None. --- src/werkzeug/debug/tbtools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/werkzeug/debug/tbtools.py b/src/werkzeug/debug/tbtools.py index d922893ea..69f504599 100644 --- a/src/werkzeug/debug/tbtools.py +++ b/src/werkzeug/debug/tbtools.py @@ -238,7 +238,7 @@ def all_tracebacks( self, ) -> list[tuple[str | None, traceback.TracebackException]]: out = [] - current = self._te + current: traceback.TracebackException | None = self._te while current is not None: if current.__cause__ is not None: From e32ca9c91d3c66cc85e001e2177079cf18c8c740 Mon Sep 17 00:00:00 2001 From: Kevin Ji <1146876+kevinji@users.noreply.github.com> Date: Wed, 11 Dec 2024 14:23:31 -0800 Subject: [PATCH 2/2] tbtools: Add typing to `out` to appease mypy --- src/werkzeug/debug/tbtools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/werkzeug/debug/tbtools.py b/src/werkzeug/debug/tbtools.py index 69f504599..416f09711 100644 --- a/src/werkzeug/debug/tbtools.py +++ b/src/werkzeug/debug/tbtools.py @@ -237,7 +237,7 @@ def __str__(self) -> str: def all_tracebacks( self, ) -> list[tuple[str | None, traceback.TracebackException]]: - out = [] + out: list[tuple[str | None, traceback.TracebackException]] = [] current: traceback.TracebackException | None = self._te while current is not None: