2
0
mirror of https://gitlab.com/ita1024/waf.git synced 2024-11-22 18:07:12 +01:00

Ensure restoration of sys.path in Context.load_module()

This commit is contained in:
Nikolaus Lieb 2015-07-25 18:27:31 +08:00
parent b22118a2de
commit 64f557a17e

View File

@ -621,8 +621,8 @@ def load_module(path, encoding=None):
module_dir = os.path.dirname(path) module_dir = os.path.dirname(path)
sys.path.insert(0, module_dir) sys.path.insert(0, module_dir)
exec(compile(code, path, 'exec'), module.__dict__) try : exec(compile(code, path, 'exec'), module.__dict__)
sys.path.remove(module_dir) finally: sys.path.remove(module_dir)
cache_modules[path] = module cache_modules[path] = module