gh-100585: Fixed a bug where importlib.resources.as_file was leaving file pointers open#100586
gh-100585: Fixed a bug where importlib.resources.as_file was leaving file pointers open#100586jaraco merged 2 commits intopython:mainfrom samety:fix-issue-100585
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_filewas leaving temporary file pointers open in the_write_contentsfunction.Fixed it by using
Path.write_bytesinstead ofopen('wb').write(...)