Skip to content

Commit

Permalink
fix outdated comments in asyncio
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaraditya303 committed Jul 15, 2024
1 parent 50eec50 commit e93f144
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
3 changes: 1 addition & 2 deletions Lib/asyncio/futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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).
Expand Down
4 changes: 2 additions & 2 deletions Lib/asyncio/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def __eager_start(self):
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()
Expand Down Expand Up @@ -379,7 +379,7 @@ def __wakeup(self, future):
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__`.
Expand Down
2 changes: 1 addition & 1 deletion Modules/_asynciomodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e93f144

Please sign in to comment.