Return type hint for SubsegmentContextManager.__enter__
in aws-xray-sdk
should include None
#13883
Labels
stubs: false negative
Type checkers do not report an error, but should
The return type hint for
SubsegmentContextManager.__enter__
isSubsegment
, but the implementation can clearly returnNone
. The type hint should therefore beOptional[Subsegment]
or equivalent.This has hit me when running tests on X-Ray-instrumented code, when there isn't a segment to derive from. I then end up with NREs as Mypy thinks that
in_subsegment
should have yielded aSubsegment
.The text was updated successfully, but these errors were encountered: