Return a context manager that pushes/pops frames on enter/exit. If can_skip is True, control flow is allowed to bypass the newly-created frame. If fall_through > 0, then it will allow control flow that falls off the end of the frame to escape to its ancestor
(
self,
*,
can_skip: bool,
fall_through: int = 1,
break_frame: int = 0,
continue_frame: int = 0,
conditional_frame: bool = False,
try_frame: bool = False,
discard: bool = False,
)
| 575 | self.unreachable() |
| 576 | |
| 577 | def frame_context( |
| 578 | self, |
| 579 | *, |
| 580 | can_skip: bool, |
| 581 | fall_through: int = 1, |
| 582 | break_frame: int = 0, |
| 583 | continue_frame: int = 0, |
| 584 | conditional_frame: bool = False, |
| 585 | try_frame: bool = False, |
| 586 | discard: bool = False, |
| 587 | ) -> FrameContext: |
| 588 | """Return a context manager that pushes/pops frames on enter/exit. |
| 589 | |
| 590 | If can_skip is True, control flow is allowed to bypass the |
| 591 | newly-created frame. |
| 592 | |
| 593 | If fall_through > 0, then it will allow control flow that |
| 594 | falls off the end of the frame to escape to its ancestor |
| 595 | `fall_through` levels higher. Otherwise, control flow ends |
| 596 | at the end of the frame. |
| 597 | |
| 598 | If break_frame > 0, then 'break' statements within this frame |
| 599 | will jump out to the frame break_frame levels higher than the |
| 600 | frame created by this call to frame_context. Similarly, for |
| 601 | continue_frame and 'continue' statements. |
| 602 | |
| 603 | If try_frame is true, then execution is allowed to jump at any |
| 604 | point within the newly created frame (or its descendants) to |
| 605 | its parent (i.e., to the frame that was on top before this |
| 606 | call to frame_context). |
| 607 | |
| 608 | If discard is True, then this is a temporary throw-away frame |
| 609 | (used e.g. for isolation) and its effect will be discarded on pop. |
| 610 | |
| 611 | After the context manager exits, self.last_pop_changed indicates |
| 612 | whether any types changed in the newly-topmost frame as a result |
| 613 | of popping this frame. |
| 614 | """ |
| 615 | return FrameContext( |
| 616 | self, |
| 617 | can_skip=can_skip, |
| 618 | fall_through=fall_through, |
| 619 | break_frame=break_frame, |
| 620 | continue_frame=continue_frame, |
| 621 | conditional_frame=conditional_frame, |
| 622 | try_frame=try_frame, |
| 623 | discard=discard, |
| 624 | ) |
| 625 | |
| 626 | @contextmanager |
| 627 | def top_frame_context(self) -> Iterator[Frame]: |
no test coverage detected