Skip to content

Commit

Permalink
gyp: python3 fixes: utf8 decode, use of 'None' in eval
Browse files Browse the repository at this point in the history
PR-URL: #1925
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
  • Loading branch information
dothebart authored and rvagg committed Nov 18, 2019
1 parent c722971 commit 8ea47ce
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gyp/pylib/gyp/generator/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -1776,7 +1776,7 @@ def WriteMakeRule(self, outputs, inputs, actions=None, comment=None,
# - The multi-output rule will have an do-nothing recipe.

# Hash the target name to avoid generating overlong filenames.
cmddigest = hashlib.sha1(command if command else self.target).hexdigest()
cmddigest = hashlib.sha1((command or self.target).encode('utf-8')).hexdigest()
intermediate = "%s.intermediate" % cmddigest
self.WriteLn('%s: %s' % (' '.join(outputs), intermediate))
self.WriteLn('\t%s' % '@:')
Expand Down
4 changes: 2 additions & 2 deletions gyp/pylib/gyp/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def LoadOneBuildFile(build_file_path, data, aux_data, includes,
if check:
build_file_data = CheckedEval(build_file_contents)
else:
build_file_data = eval(build_file_contents, {'__builtins__': None},
build_file_data = eval(build_file_contents, {'__builtins__': {}},
None)
except SyntaxError as e:
e.filename = build_file_path
Expand Down Expand Up @@ -1094,7 +1094,7 @@ def EvalSingleCondition(
else:
ast_code = compile(cond_expr_expanded, '<string>', 'eval')
cached_conditions_asts[cond_expr_expanded] = ast_code
if eval(ast_code, {'__builtins__': None}, variables):
if eval(ast_code, {'__builtins__': {}}, variables):
return true_dict
return false_dict
except SyntaxError as e:
Expand Down

0 comments on commit 8ea47ce

Please sign in to comment.