From 19f92a24357aa901b9c69adf6f4c9205e45c9c80 Mon Sep 17 00:00:00 2001 From: Steven Robertson Date: Thu, 27 Aug 2020 19:56:35 -0700 Subject: [PATCH] fix inefficient basepath check --- mitogen/master.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/mitogen/master.py b/mitogen/master.py index 89df5e4f..ad3d513b 100644 --- a/mitogen/master.py +++ b/mitogen/master.py @@ -92,9 +92,9 @@ RLOG = logging.getLogger('mitogen.ctx') # there are some cases where modules are loaded in memory only, such as # ansible collections, and the module "filename" is something like __synthetic__ # which doesn't actually exist -SPECIAL_FILE_PATHS = [ - "__synthetic__" -] +SPECIAL_FILE_PATHS = { + "__synthetic__", +} def _stdlib_paths(): @@ -198,9 +198,8 @@ def _py_filename(path): return path basepath = os.path.basename(path) - for filename in SPECIAL_FILE_PATHS: - if basepath == filename: - return path + if basepath in SPECIAL_FILE_PATHS: + return path def _get_core_source():