From e3a30dc1ba3931f8ef8632938b20878e01ce94f7 Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Fri, 21 Jun 2024 13:10:47 +0100 Subject: [PATCH] lisa.utils: Fix deprecate() decorator handling of import errors FIX A module can end up being imported several times if it results in an ImportError, as each client will import it again. Even if the module overall fails to import, it can still execute successfully @deprecate calls, which will end up being repeated on the same function multiple times. Remove the check that prevents calling the decorator several times for the same item name. --- lisa/utils.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lisa/utils.py b/lisa/utils.py index 5ca3ff81f..f74b3fdf5 100644 --- a/lisa/utils.py +++ b/lisa/utils.py @@ -2755,8 +2755,6 @@ def deprecate(msg=None, replaced_by=None, deprecated_in=None, removed_in=None, p # object, so that what the rest of the world will see is consistent # with the 'obj' key if register_deprecated_map: - # Make sure we don't accidentally override an existing entry - assert obj_name not in DEPRECATED_MAP DEPRECATED_MAP[obj_name] = { 'obj': return_obj, 'replaced_by': replaced_by, -- GitLab