From 790d50091351b043e5032ac2dcd98a8a10cf6a6e Mon Sep 17 00:00:00 2001 From: Manoj Date: Wed, 8 Apr 2026 17:50:49 +0530 Subject: [PATCH 01/10] asyncio : clarify Future.cancel(msg) behaviour --- Lib/asyncio/futures.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py index 11858a0274a69f..c19f050cfa8316 100644 --- a/Lib/asyncio/futures.py +++ b/Lib/asyncio/futures.py @@ -159,6 +159,9 @@ def cancel(self, msg=None): If the future is already done or cancelled, return False. Otherwise, change the future's state to cancelled, schedule the callbacks and return True. + + The optional argument *msg* is passed as the argument to the asyncio.CancelledError + exception raised when a cancelled Future is awaited. It can be any object. """ self.__log_traceback = False if self._state != _PENDING: From 60b2aedbd2f609f59af027095f44187965173508 Mon Sep 17 00:00:00 2001 From: Manoj Date: Wed, 8 Apr 2026 18:03:16 +0530 Subject: [PATCH 02/10] fix lint: wrap doc line --- Lib/asyncio/futures.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py index c19f050cfa8316..79a75daccbc971 100644 --- a/Lib/asyncio/futures.py +++ b/Lib/asyncio/futures.py @@ -160,8 +160,9 @@ def cancel(self, msg=None): change the future's state to cancelled, schedule the callbacks and return True. - The optional argument *msg* is passed as the argument to the asyncio.CancelledError - exception raised when a cancelled Future is awaited. It can be any object. + The optional argument *msg* is passed as the argument to the + asyncio.CancelledError exception raised when a cancelled Future + is awaited. It can be any object. """ self.__log_traceback = False if self._state != _PENDING: From a670cedea72910cd21e53605b5018ae30515ad25 Mon Sep 17 00:00:00 2001 From: Manoj Date: Wed, 8 Apr 2026 18:11:03 +0530 Subject: [PATCH 03/10] fix lint : extra space after 'Future' --- Lib/asyncio/futures.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py index 79a75daccbc971..9169b6e02bed18 100644 --- a/Lib/asyncio/futures.py +++ b/Lib/asyncio/futures.py @@ -161,7 +161,7 @@ def cancel(self, msg=None): return True. The optional argument *msg* is passed as the argument to the - asyncio.CancelledError exception raised when a cancelled Future + asyncio.CancelledError exception raised when a cancelled Future is awaited. It can be any object. """ self.__log_traceback = False From 98cd575646889a51136e10a9212161f5f32d601c Mon Sep 17 00:00:00 2001 From: Manoj Date: Thu, 9 Apr 2026 05:32:12 +0530 Subject: [PATCH 04/10] Removed docstring from Lib/asyncio/futures.py and added it in Doc/library/asyncio-future.rst --- Doc/library/asyncio-future.rst | 4 ++++ Lib/asyncio/futures.py | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/library/asyncio-future.rst b/Doc/library/asyncio-future.rst index 4b69e569523c58..7fa84dfffd11a2 100644 --- a/Doc/library/asyncio-future.rst +++ b/Doc/library/asyncio-future.rst @@ -195,6 +195,10 @@ Future Object If the Future is already *done* or *cancelled*, return ``False``. Otherwise, change the Future's state to *cancelled*, schedule the callbacks, and return ``True``. + + The optional argument *msg* is passed as the argument to the + :exc:`CancelledError` exception raised when a cancelled Future + is awaited. It can be any object. .. versionchanged:: 3.9 Added the *msg* parameter. diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py index 9169b6e02bed18..11858a0274a69f 100644 --- a/Lib/asyncio/futures.py +++ b/Lib/asyncio/futures.py @@ -159,10 +159,6 @@ def cancel(self, msg=None): If the future is already done or cancelled, return False. Otherwise, change the future's state to cancelled, schedule the callbacks and return True. - - The optional argument *msg* is passed as the argument to the - asyncio.CancelledError exception raised when a cancelled Future - is awaited. It can be any object. """ self.__log_traceback = False if self._state != _PENDING: From 440530c1ad4e15dd7426e2462ea3bd6341cf0a51 Mon Sep 17 00:00:00 2001 From: Manoj Date: Thu, 9 Apr 2026 05:37:17 +0530 Subject: [PATCH 05/10] Fixed Lint Issues by removing trailing whitespace --- Doc/library/asyncio-future.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Doc/library/asyncio-future.rst b/Doc/library/asyncio-future.rst index 7fa84dfffd11a2..83a3291a760644 100644 --- a/Doc/library/asyncio-future.rst +++ b/Doc/library/asyncio-future.rst @@ -198,7 +198,9 @@ Future Object The optional argument *msg* is passed as the argument to the :exc:`CancelledError` exception raised when a cancelled Future - is awaited. It can be any object. + is awaited. + + It can be any object. .. versionchanged:: 3.9 Added the *msg* parameter. From 40ed4cd68b1039bdfcd4df3285de2d7c591b3036 Mon Sep 17 00:00:00 2001 From: Manoj Date: Thu, 9 Apr 2026 05:40:19 +0530 Subject: [PATCH 06/10] Fix Lint Issues by removing trailing whitespace --- Doc/library/asyncio-future.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/asyncio-future.rst b/Doc/library/asyncio-future.rst index 83a3291a760644..4f8f15dbf8b065 100644 --- a/Doc/library/asyncio-future.rst +++ b/Doc/library/asyncio-future.rst @@ -199,7 +199,7 @@ Future Object The optional argument *msg* is passed as the argument to the :exc:`CancelledError` exception raised when a cancelled Future is awaited. - + It can be any object. .. versionchanged:: 3.9 From 5f560fd89baadc100ba00dbc45b65180dc4eee26 Mon Sep 17 00:00:00 2001 From: Manoj Date: Thu, 9 Apr 2026 05:42:07 +0530 Subject: [PATCH 07/10] Fix Lint Issues by removing trailing whitespace --- Doc/library/asyncio-future.rst | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Doc/library/asyncio-future.rst b/Doc/library/asyncio-future.rst index 4f8f15dbf8b065..4b82d78cff04ab 100644 --- a/Doc/library/asyncio-future.rst +++ b/Doc/library/asyncio-future.rst @@ -195,12 +195,10 @@ Future Object If the Future is already *done* or *cancelled*, return ``False``. Otherwise, change the Future's state to *cancelled*, schedule the callbacks, and return ``True``. - + The optional argument *msg* is passed as the argument to the :exc:`CancelledError` exception raised when a cancelled Future - is awaited. - - It can be any object. + is awaited.It can be any object. .. versionchanged:: 3.9 Added the *msg* parameter. From cc322d8ce02bdf81c233b5a7f20135c336e9249d Mon Sep 17 00:00:00 2001 From: Manoj Date: Thu, 9 Apr 2026 19:06:21 +0530 Subject: [PATCH 08/10] Fixed spacing in Doc/library/asyncio-future.rst --- Doc/library/asyncio-future.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/asyncio-future.rst b/Doc/library/asyncio-future.rst index 4b82d78cff04ab..5050abd5772f64 100644 --- a/Doc/library/asyncio-future.rst +++ b/Doc/library/asyncio-future.rst @@ -198,7 +198,7 @@ Future Object The optional argument *msg* is passed as the argument to the :exc:`CancelledError` exception raised when a cancelled Future - is awaited.It can be any object. + is awaited. It can be any object. .. versionchanged:: 3.9 Added the *msg* parameter. From fa83911308e84ecb39c9e05ccff898dfbd665a5f Mon Sep 17 00:00:00 2001 From: Manoj Date: Thu, 9 Apr 2026 19:25:36 +0530 Subject: [PATCH 09/10] Changed msg's explanation --- Doc/library/asyncio-future.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doc/library/asyncio-future.rst b/Doc/library/asyncio-future.rst index 5050abd5772f64..5abf62c057ae3b 100644 --- a/Doc/library/asyncio-future.rst +++ b/Doc/library/asyncio-future.rst @@ -198,7 +198,7 @@ Future Object The optional argument *msg* is passed as the argument to the :exc:`CancelledError` exception raised when a cancelled Future - is awaited. It can be any object. + is awaited. It is typically a string. .. versionchanged:: 3.9 Added the *msg* parameter. From 3da44997bdb95c41cf857d2ff0585fabc14942b3 Mon Sep 17 00:00:00 2001 From: Manoj Date: Thu, 9 Apr 2026 19:32:10 +0530 Subject: [PATCH 10/10] Changed msg's explanation and made it shorter --- Doc/library/asyncio-future.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/asyncio-future.rst b/Doc/library/asyncio-future.rst index 5abf62c057ae3b..43977de273e61f 100644 --- a/Doc/library/asyncio-future.rst +++ b/Doc/library/asyncio-future.rst @@ -196,9 +196,9 @@ Future Object Otherwise, change the Future's state to *cancelled*, schedule the callbacks, and return ``True``. - The optional argument *msg* is passed as the argument to the + The optional string argument *msg* is passed as the argument to the :exc:`CancelledError` exception raised when a cancelled Future - is awaited. It is typically a string. + is awaited. .. versionchanged:: 3.9 Added the *msg* parameter.