@@ -278,14 +278,20 @@ def get_signature_string(func_name, func_signature, evaldict):
278
278
279
279
# if type hint can not be evaluated, protect it
280
280
annotation_needs_protection = _signature_symbol_needs_protection (p .annotation , evaldict )
281
- new_annotation = _protect_signature_symbol (p .annotation , annotation_needs_protection , "HINT_%s" % p_name , evaldict )
281
+ new_annotation = _protect_signature_symbol (p .annotation , annotation_needs_protection , "HINT_%s" % p_name ,
282
+ evaldict )
282
283
283
284
# replace the parameter with the possibly new default and hint
284
285
p = Parameter (p .name , kind = p .kind , default = new_default , annotation = new_annotation )
285
286
new_params .append (p )
286
287
288
+ # if return type hint can not be evaluated, protect it
289
+ return_needs_protection = _signature_symbol_needs_protection (func_signature .return_annotation , evaldict )
290
+ new_return_annotation = _protect_signature_symbol (func_signature .return_annotation , return_needs_protection ,
291
+ "RETURNHINT" , evaldict )
292
+
287
293
# copy signature object
288
- s = Signature (parameters = new_params , return_annotation = func_signature . return_annotation )
294
+ s = Signature (parameters = new_params , return_annotation = new_return_annotation )
289
295
290
296
# return the final string representation
291
297
return "%s%s:" % (func_name , s )
0 commit comments