# Buggy code
def frame_context(self, fall_through: int = 0) -> Iterator[Frame]:
    """Return a context manager that pushes/pops frames on enter/exit.

    If fall_through > 0, then it will allow the frame to escape to
    its ancestor `fall_through` levels higher.

    A simple 'with binder.frame_context(): pass' will change the
    last_pop_* flags but nothing else.
    """
    was_breaking_out = self.breaking_out
    yield self.push_frame()
    self.pop_frame(fall_through)
    self.breaking_out = was_breaking_out


# Traceback (AttributeError)
Traceback (most recent call last):
File "./scripts/mypy", line 6, in <module>
main(__file__)
File "mypy/mypy/main.py", line 50, in main
type_check_only(sources, bin_dir, options)
File "mypy/mypy/main.py", line 94, in type_check_only
python_path=options.python_path)
File "mypy/mypy/build.py", line 210, in build
result = manager.process(initial_states)
File "mypy/mypy/build.py", line 425, in process
next.process()
File "mypy/mypy/build.py", line 930, in process
self.type_checker().visit_file(self.tree, self.tree.path)
File "mypy/mypy/checker.py", line 409, in visit_file
self.accept(d)
File "mypy/mypy/checker.py", line 450, in accept
typ = node.accept(self)
File "mypy/mypy/nodes.py", line 707, in accept
return visitor.visit_try_stmt(self)
File "mypy/mypy/checker.py", line 1732, in visit_try_stmt
self.accept(s.else_body)
File "mypy/mypy/checker.py", line 450, in accept
typ = node.accept(self)
File "mypy/mypy/nodes.py", line 526, in accept
return visitor.visit_block(self)
File "mypy/mypy/checker.py", line 1113, in visit_block
self.accept(s)
File "mypy/mypy/checker.py", line 450, in accept
typ = node.accept(self)
File "mypy/mypy/nodes.py", line 382, in accept
return visitor.visit_func_def(self)
File "mypy/mypy/checker.py", line 594, in visit_func_def
'redefinition with type')
File "mypy/mypy/checker.py", line 2117, in check_subtype
if not is_subtype(subtype, supertype):
File "mypy/mypy/subtypes.py", line 49, in is_subtype
return left.accept(SubtypeVisitor(right, type_parameter_checker))
AttributeError: 'NoneType' object has no attribute 'accept'

# Fixed code
def frame_context(
    self,
    *,
    can_skip: bool,
    fall_through: int = 1,
    break_frame: int = 0,
    continue_frame: int = 0,
    try_frame: bool = False,
) -> Iterator[Frame]:
    """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
    `fall_through` levels higher. Otherwise control flow ends
    at the end of the frame.

    If break_frame > 0, then 'break' statements within this frame
    will jump out to the frame break_frame levels higher than the
    frame created by this call to frame_context. Similarly for
    continue_frame and 'continue' statements.

    If try_frame is true, then execution is allowed to jump at any
    point within the newly created frame (or its descendents) to
    its parent (i.e., to the frame that was on top before this
    call to frame_context).

    After the context manager exits, self.last_pop_changed indicates
    whether any types changed in the newly-topmost frame as a result
    of popping this frame.
    """
    assert len(self.frames) > 1

    if break_frame:
        self.break_frames.append(len(self.frames) - break_frame)
    if continue_frame:
        self.continue_frames.append(len(self.frames) - continue_frame)
    if try_frame:
        self.try_frames.add(len(self.frames) - 1)

    new_frame = self.push_frame()
    if try_frame:
        # An exception may occur immediately
        self.allow_jump(-1)
    yield new_frame
    self.pop_frame(can_skip, fall_through)

    if break_frame:
        self.break_frames.pop()
    if continue_frame:
        self.continue_frames.pop()
    if try_frame:
        self.try_frames.remove(len(self.frames) - 1)