Skip to content

Commit 1dafc6b

Browse files
committed
add support for char constants in python < 3.8
1 parent 84be7fa commit 1dafc6b

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

cstruct/c_expr.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ def eval_call(node) -> Union[int, float]:
126126
ast.Name: eval_get,
127127
ast.Call: eval_call,
128128
Constant: lambda node: node.value,
129+
ast.Str: lambda node: node.s, # python < 3.8
129130
# and/or
130131
ast.BoolOp: lambda node: OPS[type(node.op)](node), # and/or operator
131132
ast.And: lambda node: all(eval_node(x) for x in node.values), # && operator

0 commit comments

Comments
 (0)