-
-
Notifications
You must be signed in to change notification settings - Fork 32k
docs: add an explicit close()
call to urlopen
examples without with
#130132
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
Comments
EDIT: actually, I've checked and it's not even freed upon object deletion! I couldn't find any |
urlopen
examples without with
close()
call to urlopen
examples without with
@Mr-Sunglasses @rruuaanng Proper closing should be added to all 3 quoted examples. As you may know, the audience includes learners and people from other fields than programming. |
To be honest, I'm not sure that the examples are worth keeping? Using a context manager without |
Thanks a lot @opk12 for suggestion, I've added explicit |
I think the examples are pretty outdated, probably from the time when
and Yeah I agree as it feel very outdated, we need to work on them, as most of the examples does not work or the information is outdates. let's wait for the opinion of core dev's, what they think about this issue. |
…pythonGH-130280) (cherry picked from commit 77d2fd4) Co-authored-by: Kanishk Pachauri <itskanishkp.py@gmail.com> Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…pythonGH-130280) (cherry picked from commit 77d2fd4) Co-authored-by: Kanishk Pachauri <itskanishkp.py@gmail.com> Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Thank you for the report and the fix! |
GH-130280) (#131394) gh-130132: properly free resources in `urrlib.urlopen` examples (GH-130280) (cherry picked from commit 77d2fd4) Co-authored-by: Kanishk Pachauri <itskanishkp.py@gmail.com> Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
GH-130280) (#131395) gh-130132: properly free resources in `urrlib.urlopen` examples (GH-130280) (cherry picked from commit 77d2fd4) Co-authored-by: Kanishk Pachauri <itskanishkp.py@gmail.com> Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…python#130280) Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…python#130280) Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Uh oh!
There was an error while loading. Please reload this page.
Documentation
The documentation for
urllib.request
usesurlopen()
3 times without eitherwith
or manual closing. Although technically possible, this is not recommended.This is a follow-up from ruff #13683.
Linked PRs
urrlib.urlopen
examples (GH-130280) #131394urrlib.urlopen
examples (GH-130280) #131395The text was updated successfully, but these errors were encountered: