Skip to content

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

Merged
merged 3 commits into from
Jan 23, 2024

Conversation

scop
Copy link
Contributor

@scop scop commented Nov 17, 2023

Just stumbled upon the urlopen example in contextlib.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/

@AA-Turner AA-Turner changed the title gh-66944: Note no need to use contextlib.closing with urlopen gh-66944: Note that the contextlib.closing example is for illustration purposes Jan 12, 2024
@AA-Turner AA-Turner added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Jan 12, 2024
@AA-Turner AA-Turner enabled auto-merge (squash) January 23, 2024 01:00
@AA-Turner AA-Turner merged commit 9af9ac1 into python:main Jan 23, 2024
@miss-islington-app
Copy link

Thanks @scop for the PR, and @AA-Turner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 23, 2024
…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>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jan 23, 2024
…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>
@bedevere-app
Copy link

bedevere-app bot commented Jan 23, 2024

GH-114458 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 only security fixes label Jan 23, 2024
@bedevere-app
Copy link

bedevere-app bot commented Jan 23, 2024

GH-114459 is a backport of this pull request to the 3.11 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.11 only security fixes label Jan 23, 2024
AA-Turner pushed a commit that referenced this pull request Jan 23, 2024
AA-Turner pushed a commit that referenced this pull request Jan 23, 2024
Copy link
Contributor

@danielhollas danielhollas left a 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
which closes *thing* on leaving the :keyword:`with` statment.
which closes *thing* on leaving the :keyword:`with` statement.

@AA-Turner
Copy link
Member

Thanks Daniel, would you want to open a PR? You can add me as a reviewer.

A

@scop scop deleted the docs-contextlib-urlopen branch January 26, 2024 16:00
aisk pushed a commit to aisk/cpython that referenced this pull request Feb 11, 2024
…ustrative purposes (python#112198)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
…ustrative purposes (python#112198)

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants