From cbf939c16c0c755602b9c538354d94cf4bb6583d Mon Sep 17 00:00:00 2001 From: James Bourbeau Date: Mon, 26 Feb 2024 15:37:17 -0600 Subject: [PATCH] Avoid iteration error when getting module path (#8533) --- distributed/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/distributed/utils.py b/distributed/utils.py index 74739c7be6c..47ecee12f5a 100644 --- a/distributed/utils.py +++ b/distributed/utils.py @@ -801,7 +801,7 @@ def _getmodulename_with_path(fname: str) -> str: except KeyError: pass - for modname, mod in sys.modules.items(): + for modname, mod in sys.modules.copy().items(): fname2 = getattr(mod, "__file__", None) if fname2: _getmodulename_with_path_map[fname2] = modname