Skip to content

Commit

Permalink
Revert hynek#657
Browse files Browse the repository at this point in the history
The changes introduced in hynek#657 are no longer needed since
_format_exception() is now only called if _figure_out_exc_info() detects
an actual exception
  • Loading branch information
sscherfke committed Nov 27, 2024
1 parent 3644778 commit 6d44cd3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
10 changes: 0 additions & 10 deletions src/structlog/_frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,12 @@
from .typing import ExcInfo


def is_missing_exc_info(exc_info: ExcInfo) -> bool:
"""
Return True if exc_info is the missing value.
"""
return exc_info == (None, None, None) # type: ignore[comparison-overlap]


def _format_exception(exc_info: ExcInfo) -> str:
"""
Prettyprint an `exc_info` tuple.
Shamelessly stolen from stdlib's logging module.
"""
if is_missing_exc_info(exc_info):
return "MISSING"

sio = StringIO()

traceback.print_exception(exc_info[0], exc_info[1], exc_info[2], None, sio)
Expand Down
4 changes: 0 additions & 4 deletions src/structlog/tracebacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
from types import ModuleType, TracebackType
from typing import Any, Iterable, Sequence, Tuple, Union

from ._frames import is_missing_exc_info


try:
import rich
Expand Down Expand Up @@ -414,8 +412,6 @@ def __init__(
self.use_rich = use_rich

def __call__(self, exc_info: ExcInfo) -> list[dict[str, Any]]:
if is_missing_exc_info(exc_info):
return []
trace = extract(
*exc_info,
show_locals=self.show_locals,
Expand Down

0 comments on commit 6d44cd3

Please sign in to comment.