From bd394d24861aa54f535098b209678f3b912ab484 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Tue, 17 May 2022 20:32:28 -0700 Subject: [PATCH] builtins: add BaseException.add_note in py311 (#7860) --- stdlib/builtins.pyi | 6 ++++-- tests/stubtest_allowlists/py311.txt | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index d3d34c72f..53ba2a8a2 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -1654,10 +1654,12 @@ class BaseException: __context__: BaseException | None __suppress_context__: bool __traceback__: TracebackType | None - if sys.version_info >= (3, 11): - __note__: str | None def __init__(self, *args: object) -> None: ... def with_traceback(self: Self, __tb: TracebackType | None) -> Self: ... + if sys.version_info >= (3, 11): + # only present after add_note() is called + __notes__: list[str] + def add_note(self, __note: str) -> None: ... class GeneratorExit(BaseException): ... class KeyboardInterrupt(BaseException): ... diff --git a/tests/stubtest_allowlists/py311.txt b/tests/stubtest_allowlists/py311.txt index 0c0d272e2..fb3710b46 100644 --- a/tests/stubtest_allowlists/py311.txt +++ b/tests/stubtest_allowlists/py311.txt @@ -43,7 +43,6 @@ asyncio.sslproto._SSLProtocolTransport.set_read_buffer_limits asyncio.sslproto.add_flowcontrol_defaults bdb.Breakpoint.clearBreakpoints binascii.a2b_base64 -builtins.BaseException.add_note builtins.dict.get builtins.property.__set_name__ # Doesn't actually exist concurrent.futures.ProcessPoolExecutor.__init__