From 630867ccf646d0ab8514086bed3d3151fc349e53 Mon Sep 17 00:00:00 2001
From: Andre Anjos <andre.dos.anjos@gmail.com>
Date: Tue, 13 Sep 2016 22:25:44 +0200
Subject: [PATCH] [resources] Avoid exec() as it has bugs on Python 2.7

---
 bob/bio/base/utils/resources.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/bob/bio/base/utils/resources.py b/bob/bio/base/utils/resources.py
index 62463007..19f5be63 100644
--- a/bob/bio/base/utils/resources.py
+++ b/bob/bio/base/utils/resources.py
@@ -84,7 +84,9 @@ def _collect_config(paths):
     raise IOError("The configuration file, resource or module '%s' " \
         "could not be found, loaded or imported" % paths[-1])
 
-  exec(compile(open(paths[-1], "rb").read(), paths[-1], 'exec'), retval.__dict__)
+  name = "".join(random.sample(ascii_letters, 10))
+  tmp = imp.load_source(name, paths[-1])
+  _attach_resources(tmp, retval)
 
   return retval
 
-- 
GitLab