Fixup bug 1256573 to work on buggy older python on a CLOSED TREE. r=me
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 30 Mar 2016 08:15:36 +0900
changeset 291002 8710643c72dbc2fc9ce7189ece5cf36a1a2719b3
parent 291001 690f9c2a909b45dbbc98c3d2694a0d626edb0f5a
child 291003 36e9b1eebcf22ae03e7717ac6461aa0ecf7faf68
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersme
bugs1256573
milestone48.0a1
Fixup bug 1256573 to work on buggy older python on a CLOSED TREE. r=me
python/mozbuild/mozbuild/configure/__init__.py
--- a/python/mozbuild/mozbuild/configure/__init__.py
+++ b/python/mozbuild/mozbuild/configure/__init__.py
@@ -485,17 +485,20 @@ class ConfigureSandbox(dict):
             # Until this proves to be a performance problem, just construct an
             # import statement and execute it.
             import_line = ''
             if _from:
                 import_line += 'from %s ' % _from
             import_line += 'import %s' % _import
             if _as:
                 import_line += ' as %s' % _as
-            exec(import_line, {}, glob)
+            # Some versions of python fail with "SyntaxError: unqualified exec
+            # is not allowed in function '_apply_imports' it contains a nested
+            # function with free variable" when using the exec function.
+            exec import_line in {}, glob
 
     def _resolve_and_set(self, data, name, value):
         # Don't set anything when --help was on the command line
         if self._help:
             return
         name = self._resolve(name, need_help_dependency=False)
         if name is None:
             return