# HG changeset patch # User Florent Cayré # Date 1478728800 -3600 # Node ID fdc0a8260fd2c105341604343c991d0eb6f31eb8 # Parent 48f6ebd33cb99ac4c7ccab8b689689bd8c28505e [devctl] Optimize cleanup_sys_modules a bit by moving out of a loop a costly computation that is constant. This at least benefits the `i18ncube` command. Related to #15789486. diff -r 48f6ebd33cb9 -r fdc0a8260fd2 cubicweb/devtools/devctl.py --- a/cubicweb/devtools/devctl.py Thu Nov 10 10:05:14 2016 +0100 +++ b/cubicweb/devtools/devctl.py Wed Nov 09 23:00:00 2016 +0100 @@ -102,6 +102,7 @@ def cleanup_sys_modules(config): # cleanup sys.modules, required when we're updating multiple cubes + appobjects_path = config.appobjects_path() for name, mod in list(sys.modules.items()): if mod is None: # duh ? logilab.common.os for instance @@ -112,7 +113,7 @@ if mod.__file__ is None: # odd/rare but real continue - for path in config.appobjects_path(): + for path in appobjects_path: if mod.__file__.startswith(path): del sys.modules[name] break