test_jit.py: Replace direct `exec` invocation with a wrapper. (#15882)
Summary:
Python2 doesn't allow to invoke `exec` from a nested function:
File "test/test_jit.py", line 4653
exec(code, globals(), scope)
SyntaxError: unqualified exec is not allowed in function 'test' it is a nested function
This patch wraps exec with a separate function, making it work for both python2
and python3.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15882
Differential Revision: D13614235
Pulled By: ZolotukhinM
fbshipit-source-id: 9a074308c2379f089402e0bf5a996cc649d6dbca
Author
Mikhail Zolotukhin