-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-66944: Note that the contextlib.closing
example is for illustration purposes
#112198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
contextlib.closing
with urlopen
contextlib.closing
example is for illustration purposes
Thanks @scop for the PR, and @AA-Turner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
…ustrative purposes (pythonGH-112198) (cherry picked from commit 9af9ac1) Co-authored-by: Ville Skyttä <ville.skytta@iki.fi> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
…ustrative purposes (pythonGH-112198) (cherry picked from commit 9af9ac1) Co-authored-by: Ville Skyttä <ville.skytta@iki.fi> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
GH-114458 is a backport of this pull request to the 3.12 branch. |
GH-114459 is a backport of this pull request to the 3.11 branch. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Late to the party but spotted a typo...
.. note:: | ||
|
||
Most types managing resources support the :term:`context manager` protocol, | ||
which closes *thing* on leaving the :keyword:`with` statment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which closes *thing* on leaving the :keyword:`with` statment. | |
which closes *thing* on leaving the :keyword:`with` statement. |
Thanks Daniel, would you want to open a PR? You can add me as a reviewer. A |
…ustrative purposes (python#112198) Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
…ustrative purposes (python#112198) Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Just stumbled upon the
urlopen
example incontextlib.closing
docs and later found #66944 open for it, here's a quick crack at at least documenting the unnecessity these days.📚 Documentation preview 📚: https://cpython-previews--112198.org.readthedocs.build/