Fix Context injection crash with return type annotations
Closed
SA
3mo ago+8+8+0123456789-0-0-0123456789
Summary
Fixes #3298
typing.get_type_hints()includes a"return"key when the function has a return annotation, butinspect.signature().parametersdoes not — iterating over the hints dict caused aKeyErrorwhen looking up"return"in the parameter list- Added a check to skip keys from
get_type_hints()that aren't insignature.parameters, fixing the crash without altering Context injection behavior
Test plan
- Functions with
-> ReturnTypeannotations no longer crash during context injection - Context parameters are still correctly identified and injected
- Functions without return annotations unaffected