source = 'attr = {0!r}'
created_paths = []
mapping = {}
+ state_manager = None
+ uncache_manager = None
try:
temp_dir = tempfile.gettempdir()
mapping['.root'] = temp_dir
state_manager.__enter__()
yield mapping
finally:
- state_manager.__exit__(None, None, None)
- uncache_manager.__exit__(None, None, None)
+ if state_manager is not None:
+ state_manager.__exit__(None, None, None)
+ if uncache_manager is not None:
+ uncache_manager.__exit__(None, None, None)
# Reverse the order for path removal to unroll directory creation.
for path in reversed(created_paths):
if file_path.endswith('.py'):
Tests
-----
+- Issue #7248: In importlib.test.source.util a try/finally block did not make
+ sure that some referenced objects actually were created in the block before
+ calling methods on the object.
+
- Issue #7222: Make thread "reaping" more reliable so that reference
leak-chasing test runs give sensible results. The previous method of
reaping threads could return successfully while some Thread objects were