File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 17
17
import inspect
18
18
import io
19
19
import itertools
20
+ import numbers
20
21
import os
21
22
import pprint
22
23
import re
@@ -3788,7 +3789,8 @@ def bad_node(self, node):
3788
3789
py_default = 'None'
3789
3790
c_default = "NULL"
3790
3791
elif (isinstance (expr , ast .BinOp ) or
3791
- (isinstance (expr , ast .UnaryOp ) and not isinstance (expr .operand , ast .Num ))):
3792
+ (isinstance (expr , ast .UnaryOp ) and
3793
+ not (isinstance (expr .operand , ast .Constant ) and isinstance (expr .operand .value , numbers .Number )))):
3792
3794
c_default = kwargs .get ("c_default" )
3793
3795
if not (isinstance (c_default , str ) and c_default ):
3794
3796
fail ("When you specify an expression (" + repr (default ) + ") as your default value,\n you MUST specify a valid c_default." )
@@ -3866,7 +3868,7 @@ def bad_node(self, node):
3866
3868
self .function .parameters [parameter_name ] = p
3867
3869
3868
3870
def parse_converter (self , annotation ):
3869
- if isinstance (annotation , ast .Str ):
3871
+ if isinstance (annotation , ast .Constant ) and isinstance ( expr . operand . value , str ):
3870
3872
return annotation .s , True , {}
3871
3873
3872
3874
if isinstance (annotation , ast .Name ):
You can’t perform that action at this time.
0 commit comments