-
-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
gh-126639: Add ResourceWarning to NamedTemporaryFile #126677
base: main
Are you sure you want to change the base?
gh-126639: Add ResourceWarning to NamedTemporaryFile #126677
Conversation
graingert
commented
Nov 11, 2024
•
edited by bedevere-app
bot
Loading
edited by bedevere-app
bot
- Issue: NamedTemporaryFile doesn't issue a ResourceWarning when left unclosed on POSIX #126639
ae4b87b
to
4932cd3
Compare
Ok this doesn't seem to break anything! I'll need to add a test though |
Misc/NEWS.d/next/Library/2024-11-11-07-56-03.gh-issue-126639.AmVSt-.rst
Outdated
Show resolved
Hide resolved
Misc/NEWS.d/next/Library/2024-11-11-07-56-03.gh-issue-126639.AmVSt-.rst
Outdated
Show resolved
Hide resolved
@@ -1116,11 +1116,14 @@ def my_func(dir): | |||
# Testing extreme case, where the file is not explicitly closed | |||
# f.close() | |||
return tmp_name | |||
# Make sure that the garbage collector has finalized the file object. | |||
gc.collect() |
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.
this collection didn't do anything because it ran before creating the object it was supposed to collect
TIP: You can add suggestions to batch from the files tab to apply multiple suggestions in a single commit. |
Oh yeah I know, but I found the issues with some time apart so they didn't exist together to be batched |