summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKumar Aditya <kumaraditya@python.org>2024-07-15 05:59:19 (GMT)
committerGitHub <noreply@github.com>2024-07-15 05:59:19 (GMT)
commit48042c52a6b59089e7d7dda3c8fed79d646b6f8d (patch)
treeede5383025f0870ad3256a1c8091e8a4931fcedf
parent50eec501fef46f0887df6f2f47d74f4defb35515 (diff)
downloadcpython-48042c52a6b59089e7d7dda3c8fed79d646b6f8d.zip
cpython-48042c52a6b59089e7d7dda3c8fed79d646b6f8d.tar.gz
cpython-48042c52a6b59089e7d7dda3c8fed79d646b6f8d.tar.bz2
fix outdated comments in asyncio (#121783)
-rw-r--r--Lib/asyncio/futures.py3
-rw-r--r--Lib/asyncio/tasks.py4
-rw-r--r--Modules/_asynciomodule.c2
3 files changed, 4 insertions, 5 deletions
diff --git a/Lib/asyncio/futures.py b/Lib/asyncio/futures.py
index 9c1b5e4..5f6fa23 100644
--- a/Lib/asyncio/futures.py
+++ b/Lib/asyncio/futures.py
@@ -43,7 +43,6 @@ class Future:
- This class is not compatible with the wait() and as_completed()
methods in the concurrent.futures package.
- (In Python 3.4 or later we may be able to unify the implementations.)
"""
# Class variables serving as defaults for instance variables.
@@ -61,7 +60,7 @@ class Future:
# the Future protocol (i.e. is intended to be duck-type compatible).
# The value must also be not-None, to enable a subclass to declare
# that it is not compatible by setting this to None.
- # - It is set by __iter__() below so that Task._step() can tell
+ # - It is set by __iter__() below so that Task.__step() can tell
# the difference between
# `await Future()` or`yield from Future()` (correct) vs.
# `yield Future()` (incorrect).
diff --git a/Lib/asyncio/tasks.py b/Lib/asyncio/tasks.py
index cd86993..2f8f4f0 100644
--- a/Lib/asyncio/tasks.py
+++ b/Lib/asyncio/tasks.py
@@ -281,7 +281,7 @@ class Task(futures._PyFuture): # Inherit Python Task implementation
def __step(self, exc=None):
if self.done():
raise exceptions.InvalidStateError(
- f'_step(): already done: {self!r}, {exc!r}')
+ f'__step(): already done: {self!r}, {exc!r}')
if self._must_cancel:
if not isinstance(exc, exceptions.CancelledError):
exc = self._make_cancelled_error()
@@ -379,7 +379,7 @@ class Task(futures._PyFuture): # Inherit Python Task implementation
else:
# Don't pass the value of `future.result()` explicitly,
# as `Future.__iter__` and `Future.__await__` don't need it.
- # If we call `_step(value, None)` instead of `_step()`,
+ # If we call `__step(value, None)` instead of `__step()`,
# Python eval loop would use `.send(value)` method call,
# instead of `__next__()`, which is slower for futures
# that return non-generator iterators from their `__iter__`.
diff --git a/Modules/_asynciomodule.c b/Modules/_asynciomodule.c
index d5d28f8..5824c47 100644
--- a/Modules/_asynciomodule.c
+++ b/Modules/_asynciomodule.c
@@ -2892,7 +2892,7 @@ task_step_impl(asyncio_state *state, TaskObj *task, PyObject *exc)
if (task->task_state != STATE_PENDING) {
PyErr_Format(state->asyncio_InvalidStateError,
- "_step(): already done: %R %R",
+ "__step(): already done: %R %R",
task,
exc ? exc : Py_None);
goto fail;