From 21da1ed15b39620ddc0254743609d760f4c22137 Mon Sep 17 00:00:00 2001 From: Zachary Turner Date: Fri, 15 Jan 2016 22:22:35 +0000 Subject: Fix ResourceWarning about unclosed file in use_lldb_suite_root.py. llvm-svn: 257945 --- lldb/scripts/Python/use_lldb_suite.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lldb/scripts/Python/use_lldb_suite.py') diff --git a/lldb/scripts/Python/use_lldb_suite.py b/lldb/scripts/Python/use_lldb_suite.py index 63a098cea22..f3e358af143 100644 --- a/lldb/scripts/Python/use_lldb_suite.py +++ b/lldb/scripts/Python/use_lldb_suite.py @@ -17,6 +17,9 @@ def find_lldb_root(): lldb_root = find_lldb_root() if lldb_root is not None: import imp - module = imp.find_module("use_lldb_suite_root", [lldb_root]) - if module is not None: - imp.load_module("use_lldb_suite_root", *module) + fp, pathname, desc = imp.find_module("use_lldb_suite_root", [lldb_root]) + try: + imp.load_module("use_lldb_suite_root", fp, pathname, desc) + finally: + if fp: + fp.close() -- cgit v1.2.3