From 1b7eb9d46409f7f272303faa9edf6f1216e35b96 Mon Sep 17 00:00:00 2001
From: Amir MOHAMMADI <amir.mohammadi@idiap.ch>
Date: Thu, 3 Mar 2022 18:29:32 +0100
Subject: [PATCH] do not propogate __ variables when config chain loading Fixes
 #76

---
 bob/extension/config.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/bob/extension/config.py b/bob/extension/config.py
index a800b95..5421621 100644
--- a/bob/extension/config.py
+++ b/bob/extension/config.py
@@ -227,7 +227,9 @@ def load(paths, context=None, entry_point_group=None, attribute_name=None):
     # remove the keys that might break the loading of the next config file.
     ctxt.__dict__.pop('__name__', None)
     ctxt.__dict__.pop('__package__', None)
-    mod.__dict__.update(ctxt.__dict__)
+    # do not propogate __ variables
+    context = {k: v for k, v in ctxt.__dict__.items() if not k.startswith('__')}
+    mod.__dict__.update(context)
     LOADED_CONFIGS.append(mod)
     ctxt = _load_context(k, mod)
 
-- 
GitLab