Skip to content

Commit 4c4f999

Browse files
authored
Add explicit definition for __repr__ and __str__ in BaseException (#14900)
1 parent 11e7d90 commit 4c4f999

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

stdlib/builtins.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2058,6 +2058,10 @@ class BaseException:
20582058
def __new__(cls, *args: Any, **kwds: Any) -> Self: ...
20592059
def __setstate__(self, state: dict[str, Any] | None, /) -> None: ...
20602060
def with_traceback(self, tb: TracebackType | None, /) -> Self: ...
2061+
# Necessary for security-focused static analyzers (e.g, pysa)
2062+
# See https://github.com/python/typeshed/pull/14900
2063+
def __str__(self) -> str: ... # noqa: Y029
2064+
def __repr__(self) -> str: ... # noqa: Y029
20612065
if sys.version_info >= (3, 11):
20622066
# only present after add_note() is called
20632067
__notes__: list[str]

0 commit comments

Comments
 (0)