filter-repo: workaround python<2.7.9 exec bug

Python issue 21591 will cause SyntaxError messages to by thrown if using
python versions prior to 2.7.9.  Use the workaround identified in the
bug report: use the exec statement instead of the exec function, even if
this will need to be reverted for python3.

Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
Elijah Newren 2019-04-30 23:42:34 -07:00
parent 068dd66b70
commit 4d0264ab72

View File

@ -2621,8 +2621,8 @@ class RepoFilter(object):
def _handle_arg_callbacks(self):
def make_callback(argname, str):
exec('def callback({}):\n'.format(argname)+
' '+'\n '.join(str.splitlines()), globals())
exec 'def callback({}):\n'.format(argname)+\
' '+'\n '.join(str.splitlines()) in globals()
return callback #namespace['callback']
def handle(type):
callback_field = '_{}_callback'.format(type)