]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-100585: Fixed a bug where importlib.resources.as_file was leaving file pointers...
authorSamet YASLAN <sametyaslan@gmail.com>
Wed, 28 Dec 2022 21:31:43 +0000 (22:31 +0100)
committerGitHub <noreply@github.com>
Wed, 28 Dec 2022 21:31:43 +0000 (16:31 -0500)
* gh-100585: Fixed open fp bug in the imporlib module

* Added news for gh-100585

Lib/importlib/resources/_common.py
Misc/NEWS.d/next/Library/2022-12-28-17-38-39.gh-issue-100585.BiiTlG.rst [new file with mode: 0644]

index 8c0be7ee547e01888535b7b47669d8021e0962ee..92a37e2c12b8d9047ae661c736fe09cf8d638496 100644 (file)
@@ -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 (file)
index 0000000..0bf33b8
--- /dev/null
@@ -0,0 +1 @@
+Fixed a bug where importlib.resources.as_file was leaving file pointers open