We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 54a61c4 + 778172d commit 64484b7Copy full SHA for 64484b7
CHANGES.rst
@@ -1,3 +1,8 @@
1
+v5.2.2
2
+======
3
+
4
+* #234: Fix refleak in ``as_file`` caught by CPython tests.
5
6
v5.2.1
7
======
8
importlib_resources/_common.py
@@ -87,14 +87,16 @@ def _tempfile(reader, suffix=''):
87
# properly.
88
fd, raw_path = tempfile.mkstemp(suffix=suffix)
89
try:
90
- os.write(fd, reader())
91
- os.close(fd)
+ try:
+ os.write(fd, reader())
92
+ finally:
93
+ os.close(fd)
94
del reader
95
yield pathlib.Path(raw_path)
96
finally:
97
98
os.remove(raw_path)
- except (FileNotFoundError, PermissionError):
99
+ except FileNotFoundError:
100
pass
101
102
0 commit comments