mirror of
https://github.com/python/cpython.git
synced 2025-09-18 14:40:43 +00:00
bpo-44771: Sync with importlib_resources 5.2.2, fixing refleak. (#27497)
* bpo-44771: Sync with importlib_resources 5.2.2, fixing refleak. * Include new 'resources' dir in the Makefile.
This commit is contained in:
parent
48a62559df
commit
e63e6311aa
2 changed files with 6 additions and 3 deletions
|
@ -87,14 +87,16 @@ def _tempfile(reader, suffix=''):
|
||||||
# properly.
|
# properly.
|
||||||
fd, raw_path = tempfile.mkstemp(suffix=suffix)
|
fd, raw_path = tempfile.mkstemp(suffix=suffix)
|
||||||
try:
|
try:
|
||||||
os.write(fd, reader())
|
try:
|
||||||
os.close(fd)
|
os.write(fd, reader())
|
||||||
|
finally:
|
||||||
|
os.close(fd)
|
||||||
del reader
|
del reader
|
||||||
yield pathlib.Path(raw_path)
|
yield pathlib.Path(raw_path)
|
||||||
finally:
|
finally:
|
||||||
try:
|
try:
|
||||||
os.remove(raw_path)
|
os.remove(raw_path)
|
||||||
except (FileNotFoundError, PermissionError):
|
except FileNotFoundError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1516,6 +1516,7 @@ TESTSUBDIRS= ctypes/test \
|
||||||
test/test_importlib/namespace_pkgs/project3/parent/child \
|
test/test_importlib/namespace_pkgs/project3/parent/child \
|
||||||
test/test_importlib/namespacedata01 \
|
test/test_importlib/namespacedata01 \
|
||||||
test/test_importlib/partial \
|
test/test_importlib/partial \
|
||||||
|
test/test_importlib/resources \
|
||||||
test/test_importlib/source \
|
test/test_importlib/source \
|
||||||
test/test_importlib/zipdata01 \
|
test/test_importlib/zipdata01 \
|
||||||
test/test_importlib/zipdata02 \
|
test/test_importlib/zipdata02 \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue