-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
NamedTemporaryFile doesn't issue a ResourceWarning when left unclosed on POSIX #126639
Comments
I think this Lines 471 to 472 in 450db61
|
This comment was marked as resolved.
This comment was marked as resolved.
I don't see how that's related? The resource delete on |
Ah sorry, I misunderstood the "open again" in the sense that you can leave the descriptor hanging. My bad. However, non-named temporary files say:
Should implicit close emit a warning in this case? Actually, why is there a warning on Windows? |
Yes, all implicit closing of resources on GC should issue a ResourceWarning |
I suspect the way to go here is to replace _TemporaryFileCloser with a weakref.finalize |
Looks like it, Lines 885 to 888 in 450db61
|
Bug report
Bug description:
when run with
python -Werror demo.py
nothing happensif you open a file normally you get a ResourceWarning:
it appears that you do get a ResourceWarning on windows, but I've only seen it in CI I havn't reproduced locally yet
CPython versions tested on:
3.12
Operating systems tested on:
Linux
Linked PRs
The text was updated successfully, but these errors were encountered: