Skip to content

Commit 1e8dee8

Browse files
committed
fix code style issues in helper function in test_quote_py_str
1 parent b93eb7d commit 1e8dee8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test/framework/easyconfig.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2145,15 +2145,15 @@ def eval_quoted_string(quoted_val, val):
21452145
Helper function to sanity check we can use the quoted string in Python contexts.
21462146
Returns the evaluated (i.e. unquoted) string
21472147
"""
2148-
globals = dict()
2148+
scope = dict()
21492149
try:
21502150
# this is needlessly complicated because we can't use 'exec' here without potentially running
21512151
# into a SyntaxError bug in old Python 2.7 versions (for example when running the tests in CentOS 7.9)
21522152
# cfr. https://stackoverflow.com/questions/4484872/why-doesnt-exec-work-in-a-function-with-a-subfunction
2153-
edict = {}; eval(compile('res = %s' % quoted_val, '<string>', 'exec'), globals, edict)
2154-
except Exception as e: # pylint: disable=broad-except
2155-
self.fail('Failed to evaluate %s (from %s): %s' % (quoted_val, val, e))
2156-
return edict['res']
2153+
eval(compile('res = %s' % quoted_val, '<string>', 'exec'), dict(), scope)
2154+
except Exception as err: # pylint: disable=broad-except
2155+
self.fail('Failed to evaluate %s (from %s): %s' % (quoted_val, val, err))
2156+
return scope['res']
21572157

21582158
def assertEqual_unquoted(quoted_val, val):
21592159
"""Assert that evaluating the quoted_val yields the val"""

0 commit comments

Comments
 (0)