Closed
Description
The return type hint for SubsegmentContextManager.__enter__
is Subsegment
, but the implementation can clearly return None
. The type hint should therefore be Optional[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 a Subsegment
.