Skip to content

Commit daa28d7

Browse files
[3.12] Doc: Clarify the return type of Event.wait when timeout is used (GH-104168) (GH-115938)
(cherry picked from commit 37f5d06) Co-authored-by: Phil Elson <[email protected]>
1 parent 551e12f commit daa28d7

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

Doc/library/threading.rst

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -983,18 +983,15 @@ method. The :meth:`~Event.wait` method blocks until the flag is true.
983983

984984
.. method:: wait(timeout=None)
985985

986-
Block until the internal flag is true. If the internal flag is true on
987-
entry, return immediately. Otherwise, block until another thread calls
988-
:meth:`.set` to set the flag to true, or until the optional timeout occurs.
986+
Block as long as the internal flag is false and the timeout, if given,
987+
has not expired. The return value represents the
988+
reason that this blocking method returned; ``True`` if returning because
989+
the internal flag is set to true, or ``False`` if a timeout is given and
990+
the the internal flag did not become true within the given wait time.
989991

990992
When the timeout argument is present and not ``None``, it should be a
991-
floating point number specifying a timeout for the operation in seconds
992-
(or fractions thereof).
993-
994-
This method returns ``True`` if and only if the internal flag has been set to
995-
true, either before the wait call or after the wait starts, so it will
996-
always return ``True`` except if a timeout is given and the operation
997-
times out.
993+
floating point number specifying a timeout for the operation in seconds,
994+
or fractions thereof.
998995

999996
.. versionchanged:: 3.1
1000997
Previously, the method always returned ``None``.

0 commit comments

Comments
 (0)