Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gevent
Commits
6825fc1a
Commit
6825fc1a
authored
Jul 09, 2021
by
Jason Madden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Strengthen the wording about closing 'Timeout' objects. [skip ci]
parent
ade482c8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
src/gevent/timeout.py
src/gevent/timeout.py
+10
-9
No files found.
src/gevent/timeout.py
View file @
6825fc1a
...
...
@@ -83,15 +83,16 @@ class Timeout(BaseException):
finally:
timeout.close()
..
note
::
..
warning
::
If the code that the timeout was protecting finishes
executing before the timeout elapses, be sure to ``close`` the
timeout so it is not unexpectedly raised in the future. Even if it
is raised, it is a best practice to close it. This ``try/finally``
construct or a ``with`` statement is a recommended pattern. (If
the timeout object will be started again, use ``cancel`` instead
of ``close``; this is rare.)
You must **always** call `close` on a ``Timeout`` object you have created,
whether or not the code that the timeout was protecting finishes
executing before the timeout elapses (whether or not the
``Timeout`` exception is raised) This ``try/finally``
construct or a ``with`` statement is a good pattern. (If
the timeout object will be started again, use `cancel` instead
of `close`; this is rare. You must still `close` it when you are
done.)
When *exception* is omitted or ``None``, the ``Timeout`` instance
itself is raised::
...
...
@@ -187,7 +188,7 @@ class Timeout(BaseException):
.. versionchanged:: 1.3a1
Timeout objects now have a :meth:`close`
method that
must
be called when the timeout will no longer be
method that
*must*
be called when the timeout will no longer be
used to properly clean up native resources.
The ``with`` statement does this automatically.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment