From 693c4f19b495c810862dc196dba04bc548d22a8a Mon Sep 17 00:00:00 2001 From: Rick Voormolen Date: Wed, 11 May 2022 11:13:29 +0200 Subject: [PATCH] Mark `Future._callbacks` as a `@property` (#7829) --- stdlib/asyncio/futures.pyi | 1 + tests/stubtest_allowlists/py310.txt | 2 -- tests/stubtest_allowlists/py37.txt | 2 -- tests/stubtest_allowlists/py38.txt | 2 -- tests/stubtest_allowlists/py39.txt | 2 -- 5 files changed, 1 insertion(+), 8 deletions(-) diff --git a/stdlib/asyncio/futures.pyi b/stdlib/asyncio/futures.pyi index 692d263f6..21bfe86e4 100644 --- a/stdlib/asyncio/futures.pyi +++ b/stdlib/asyncio/futures.pyi @@ -55,6 +55,7 @@ class Future(Awaitable[_T], Iterable[_T]): def __del__(self) -> None: ... if sys.version_info >= (3, 7): def get_loop(self) -> AbstractEventLoop: ... + @property def _callbacks(self: Self) -> list[tuple[Callable[[Self], Any], Context]]: ... def add_done_callback(self: Self, __fn: Callable[[Self], Any], *, context: Context | None = ...) -> None: ... else: diff --git a/tests/stubtest_allowlists/py310.txt b/tests/stubtest_allowlists/py310.txt index cfd8c6f14..2bd4b701b 100644 --- a/tests/stubtest_allowlists/py310.txt +++ b/tests/stubtest_allowlists/py310.txt @@ -34,9 +34,7 @@ ast.NameConstant.__new__ ast.Num.__new__ ast.Str.__new__ asyncio.Future.__init__ # Usually initialized from c object -asyncio.Future._callbacks # Usually initialized from c object asyncio.futures.Future.__init__ # Usually initialized from c object -asyncio.futures.Future._callbacks # Usually initialized from c object builtins.dict.get builtins.float.__setformat__ # Internal method for CPython test suite builtins.property.__set_name__ # Doesn't actually exist diff --git a/tests/stubtest_allowlists/py37.txt b/tests/stubtest_allowlists/py37.txt index 45b035b7c..cf733aebb 100644 --- a/tests/stubtest_allowlists/py37.txt +++ b/tests/stubtest_allowlists/py37.txt @@ -6,9 +6,7 @@ _dummy_threading asyncio.AbstractEventLoop.run_in_executor # allowed to return a Future, changed in 3.8 asyncio.events.AbstractEventLoop.run_in_executor # allowed to return a Future, changed in 3.8 asyncio.Future.__init__ # Usually initialized from c object -asyncio.Future._callbacks # Usually initialized from c object asyncio.futures.Future.__init__ # Usually initialized from c object -asyncio.futures.Future._callbacks # Usually initialized from c object asyncio.locks._ContextManagerMixin.__enter__ # Always raises; deliberately omitted from the stub asyncio.locks._ContextManagerMixin.__exit__ # Always raises; deliberately omitted from the stub asyncio.transports.WriteTransport.get_write_buffer_limits # Documented. Exists in subclasses, but not in WriteTransport itself diff --git a/tests/stubtest_allowlists/py38.txt b/tests/stubtest_allowlists/py38.txt index 76228db99..19543a524 100644 --- a/tests/stubtest_allowlists/py38.txt +++ b/tests/stubtest_allowlists/py38.txt @@ -12,9 +12,7 @@ ast.NameConstant.__new__ ast.Num.__new__ ast.Str.__new__ asyncio.Future.__init__ # Usually initialized from c object -asyncio.Future._callbacks # Usually initialized from c object asyncio.futures.Future.__init__ # Usually initialized from c object -asyncio.futures.Future._callbacks # Usually initialized from c object asyncio.locks._ContextManagerMixin.__enter__ # Always raises; deliberately omitted from the stub asyncio.locks._ContextManagerMixin.__exit__ # Always raises; deliberately omitted from the stub asyncio.transports.WriteTransport.get_write_buffer_limits # Documented. Exists in subclasses, but not in WriteTransport itself diff --git a/tests/stubtest_allowlists/py39.txt b/tests/stubtest_allowlists/py39.txt index b947ee091..f7d2a4dd5 100644 --- a/tests/stubtest_allowlists/py39.txt +++ b/tests/stubtest_allowlists/py39.txt @@ -16,9 +16,7 @@ ast.NameConstant.__new__ ast.Num.__new__ ast.Str.__new__ asyncio.Future.__init__ # Usually initialized from c object -asyncio.Future._callbacks # Usually initialized from c object asyncio.futures.Future.__init__ # Usually initialized from c object -asyncio.futures.Future._callbacks # Usually initialized from c object builtins.dict.get builtins.float.__setformat__ # Internal method for CPython test suite collections.AsyncGenerator.asend # async at runtime, deliberately not in the stub, see #7491. Pos-only differences also.