Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions fire/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ def DefaultParseValue(value):
Returns:
The parsed value, of the type determined most appropriate.
"""
# Note: _LiteralEval will treat '#' as the start of a comment.
try:
return _LiteralEval(value)
except (SyntaxError, ValueError):
Expand Down Expand Up @@ -105,8 +104,12 @@ def _LiteralEval(value):
child[index] = _Replacement(subchild)

elif isinstance(child, ast.Name):
replacement = _Replacement(child)
node.__setattr__(field, replacement)
if isinstance(type(value), str) and not isinstance(type(value), int):
replacement = ast.Str(value)
node.__setattr__(field, replacement)
else:
replacement = _Replacement(child)
node.__setattr__(field, replacement)

# ast.literal_eval supports the following types:
# strings, bytes, numbers, tuples, lists, dicts, sets, booleans, and None
Expand Down