From 0aa8bbfe1e42349acff3854bfd9f0b3488dd1b98 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Thu, 6 Jan 2022 05:03:11 -0800 Subject: [PATCH] Reflect 'context' arg in 'AbstractEventLoop.call_*()' methods (GH-30427) (#30429) (cherry picked from commit 3e43fac2503afe219336742b150b3ef6e470686f) Co-authored-by: Andrew Svetlov Co-authored-by: Andrew Svetlov --- Lib/asyncio/events.py | 8 ++++---- .../next/Library/2022-01-06-13-38-00.bpo-46278.wILA80.rst | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2022-01-06-13-38-00.bpo-46278.wILA80.rst diff --git a/Lib/asyncio/events.py b/Lib/asyncio/events.py index c8e4b407b476..db7720abcfed 100644 --- a/Lib/asyncio/events.py +++ b/Lib/asyncio/events.py @@ -258,13 +258,13 @@ class AbstractEventLoop: """Notification that a TimerHandle has been cancelled.""" raise NotImplementedError - def call_soon(self, callback, *args): + def call_soon(self, callback, *args, context=None): return self.call_later(0, callback, *args) - def call_later(self, delay, callback, *args): + def call_later(self, delay, callback, *args, context=None): raise NotImplementedError - def call_at(self, when, callback, *args): + def call_at(self, when, callback, *args, cotext=None): raise NotImplementedError def time(self): @@ -280,7 +280,7 @@ class AbstractEventLoop: # Methods for interacting with threads. - def call_soon_threadsafe(self, callback, *args): + def call_soon_threadsafe(self, callback, *args, context=None): raise NotImplementedError def run_in_executor(self, executor, func, *args): diff --git a/Misc/NEWS.d/next/Library/2022-01-06-13-38-00.bpo-46278.wILA80.rst b/Misc/NEWS.d/next/Library/2022-01-06-13-38-00.bpo-46278.wILA80.rst new file mode 100644 index 000000000000..40849044cf1c --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-01-06-13-38-00.bpo-46278.wILA80.rst @@ -0,0 +1,2 @@ +Reflect ``context`` argument in ``AbstractEventLoop.call_*()`` methods. Loop +implementations already support it. -- 2.47.3