-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
ResourceWarning in urllib tests #128734
Comments
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Jan 11, 2025
serhiy-storchaka
added a commit
that referenced
this issue
Jan 12, 2025
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Jan 12, 2025
…-128735) (cherry picked from commit 5ace717) Co-authored-by: Serhiy Storchaka <[email protected]>
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
Jan 12, 2025
…-128735) (cherry picked from commit 5ace717) Co-authored-by: Serhiy Storchaka <[email protected]>
The warnings are only emitted in the main branch, but it is worth to backport the changes to prevent depending on the garbage collector. It may matter on PyPy and others implementations. |
serhiy-storchaka
added
3.12
bugs and security fixes
3.13
bugs and security fixes
3.14
new features, bugs and security fixes
labels
Jan 12, 2025
serhiy-storchaka
added a commit
that referenced
this issue
Jan 12, 2025
serhiy-storchaka
added a commit
that referenced
this issue
Jan 12, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Many
urllib
tests produce resource warnings. For example (there are much more cases):The reason is that
addinfourl()
is a subclass oftempfile._TemporaryFileWrapper
. It keeps a reference to an open file and emits a warning in its destructor if was not explicitly closed.The solution: every result of
urllib.request.open()
and similar functions and any HTTPError exception should be explicitly closed.See also #128731.
Linked PRs
The text was updated successfully, but these errors were encountered: