Commit 5017eaa7 authored by Florent Cayré's avatar Florent Cayré
Browse files

[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.

branch : 3.24
parent 48f6ebd33cb9
......@@ -102,6 +102,7 @@ class DevConfiguration(ServerConfiguration, WebConfiguration):
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 @@ def cleanup_sys_modules(config):
if mod.__file__ is None:
# odd/rare but real
for path in config.appobjects_path():
for path in appobjects_path:
if mod.__file__.startswith(path):
del sys.modules[name]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment