Skip to content
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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

graingert
Copy link
Contributor

@graingert graingert commented Nov 11, 2024

@graingert graingert force-pushed the add-warning-to-named-temporary-file branch from ae4b87b to 4932cd3 Compare November 11, 2024 08:05
@graingert
Copy link
Contributor Author

Ok this doesn't seem to break anything! I'll need to add a test though

@graingert graingert marked this pull request as ready for review November 11, 2024 08:20
Lib/test/test_tempfile.py Outdated Show resolved Hide resolved
Lib/tempfile.py 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()
Copy link
Contributor Author

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

@nineteendo
Copy link
Contributor

nineteendo commented Nov 11, 2024

TIP: You can add suggestions to batch from the files tab to apply multiple suggestions in a single commit.

@graingert
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants