-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-100585: Fixed a bug where importlib.resources.as_file was leaving file pointers open #100586
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
Conversation
@samety thanks for the fix! It does look correct to me. @jaraco, we already have a fix in https://github.com/python/importlib_resources (python/importlib_resources@a4b3ef8), how do you want to handle these situations? |
I have plans to merge the fix from _resources to here, but I think I'd prefer to get the |
On further consideration, it's probably fine to merge this now. Since importlib_resources v5.10.2 applies the same change, It won't conflict when importlib_resources is merged. |
I looked at the failing test and it seems to be unrelated. |
Sorry, @samety and @jaraco, I could not cleanly backport this to |
Sorry @samety and @jaraco, I had trouble checking out the |
gh-100585: Fixed a bug where importlib.resources.as_file was leaving file pointers open
importlib.resources.as_file
was leaving temporary file pointers open in the_write_contents
function.Fixed it by using
Path.write_bytes
instead ofopen('wb').write(...)