[Python-checkins] gh-101143: Remove references to `TimerHandle` from `asyncio.base_events.BaseEventLoop._add_callback` (#101197)

kumaraditya303 webhook-mailer at python.org
Sat Jan 21 04:16:13 EST 2023


https://github.com/python/cpython/commit/9e947675ae3dc32f5863e5ed3022301cf7fd79b4
commit: 9e947675ae3dc32f5863e5ed3022301cf7fd79b4
branch: main
author: J. Nick Koston <nick at koston.org>
committer: kumaraditya303 <59607654+kumaraditya303 at users.noreply.github.com>
date: 2023-01-21T14:46:07+05:30
summary:

gh-101143: Remove references to `TimerHandle` from `asyncio.base_events.BaseEventLoop._add_callback` (#101197)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303 at users.noreply.github.com>

files:
A Misc/NEWS.d/next/Library/2023-01-20-10-46-59.gh-issue-101143.hJo8hu.rst
M Lib/asyncio/base_events.py

diff --git a/Lib/asyncio/base_events.py b/Lib/asyncio/base_events.py
index cbabb43ae060..32d7e1c481ec 100644
--- a/Lib/asyncio/base_events.py
+++ b/Lib/asyncio/base_events.py
@@ -1857,12 +1857,9 @@ def call_exception_handler(self, context):
                                  exc_info=True)
 
     def _add_callback(self, handle):
-        """Add a Handle to _scheduled (TimerHandle) or _ready."""
-        assert isinstance(handle, events.Handle), 'A Handle is required here'
-        if handle._cancelled:
-            return
-        assert not isinstance(handle, events.TimerHandle)
-        self._ready.append(handle)
+        """Add a Handle to _ready."""
+        if not handle._cancelled:
+            self._ready.append(handle)
 
     def _add_callback_signalsafe(self, handle):
         """Like _add_callback() but called from a signal handler."""
diff --git a/Misc/NEWS.d/next/Library/2023-01-20-10-46-59.gh-issue-101143.hJo8hu.rst b/Misc/NEWS.d/next/Library/2023-01-20-10-46-59.gh-issue-101143.hJo8hu.rst
new file mode 100644
index 000000000000..d14b9e25a691
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2023-01-20-10-46-59.gh-issue-101143.hJo8hu.rst
@@ -0,0 +1,2 @@
+Remove unused references to :class:`~asyncio.TimerHandle` in
+``asyncio.base_events.BaseEventLoop._add_callback``.



More information about the Python-checkins mailing list