summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/importlib/resources/_common.py2
-rw-r--r--Misc/NEWS.d/next/Library/2022-12-28-17-38-39.gh-issue-100585.BiiTlG.rst1
2 files changed, 2 insertions, 1 deletions
diff --git a/Lib/importlib/resources/_common.py b/Lib/importlib/resources/_common.py
index 8c0be7e..92a37e2 100644
--- a/Lib/importlib/resources/_common.py
+++ b/Lib/importlib/resources/_common.py
@@ -155,5 +155,5 @@ def _write_contents(target, source):
for item in source.iterdir():
_write_contents(child, item)
else:
- child.open('wb').write(source.read_bytes())
+ child.write_bytes(source.read_bytes())
return child
diff --git a/Misc/NEWS.d/next/Library/2022-12-28-17-38-39.gh-issue-100585.BiiTlG.rst b/Misc/NEWS.d/next/Library/2022-12-28-17-38-39.gh-issue-100585.BiiTlG.rst
new file mode 100644
index 0000000..0bf33b8
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2022-12-28-17-38-39.gh-issue-100585.BiiTlG.rst
@@ -0,0 +1 @@
+Fixed a bug where importlib.resources.as_file was leaving file pointers open