Skip to content

Commit

Permalink
Merge pull request #274 from tirkarthi/fix-warnings
Browse files Browse the repository at this point in the history
Fix ResourceWarning due to unclosed file resource.
  • Loading branch information
jaraco committed Dec 6, 2022
2 parents d3f1e59 + 45edbc1 commit b14f9b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGES.rst
@@ -1,3 +1,8 @@
v5.10.1
=======

* #274: Fixed ``ResourceWarning`` in ``_common``.

v5.10.0
=======

Expand Down
3 changes: 2 additions & 1 deletion importlib_resources/_common.py
Expand Up @@ -203,5 +203,6 @@ def _write_contents(target, source):
for item in source.iterdir():
_write_contents(child, item)
else:
child.open('wb').write(source.read_bytes())
with child.open('wb') as fp:
fp.write(source.read_bytes())
return child

0 comments on commit b14f9b5

Please sign in to comment.