# Buggy code
def __init__(self) -> None:
    # The set of frames currently used.  These map
    # expr.literal_hash -- literals like 'foo.bar' --
    # to types.
    self.frames = [Frame()]

    # For frames higher in the stack, we record the set of
    # Frames that can escape there
    self.options_on_return = []  # type: List[List[Frame]]

    # Maps expr.literal_hash] to get_declaration(expr)
    # for every expr stored in the binder
    self.declarations = Frame()
    # Set of other keys to invalidate if a key is changed, e.g. x -> {x.a, x[0]}
    # Whenever a new key (e.g. x.a.b) is added, we update this
    self.dependencies = {}  # type: Dict[Key, Set[Key]]

    # breaking_out is set to True on return/break/continue/raise
    # It is cleared on pop_frame() and placed in last_pop_breaking_out
    # Lines of code after breaking_out = True are unreachable and not
    # typechecked.
    self.breaking_out = False

    # Whether the last pop changed the newly top frame on exit
    self.last_pop_changed = False
    # Whether the last pop was necessarily breaking out, and couldn't fall through
    self.last_pop_breaking_out = False

    self.try_frames = set()  # type: Set[int]
    self.loop_frames = []  # type: List[int]


# 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 __init__(self) -> None:
    # The stack of frames currently used.  These map
    # expr.literal_hash -- literals like 'foo.bar' --
    # to types. The last element of this list is the
    # top-most, current frame. Each earlier element
    # records the state as of when that frame was last
    # on top of the stack.
    self.frames = [Frame()]

    # For frames higher in the stack, we record the set of
    # Frames that can escape there, either by falling off
    # the end of the frame or by a loop control construct
    # or raised exception. The last element of self.frames
    # has no corresponding element in this list.
    self.options_on_return = []  # type: List[List[Frame]]

    # Maps expr.literal_hash] to get_declaration(expr)
    # for every expr stored in the binder
    self.declarations = Frame()
    # Set of other keys to invalidate if a key is changed, e.g. x -> {x.a, x[0]}
    # Whenever a new key (e.g. x.a.b) is added, we update this
    self.dependencies = {}  # type: Dict[Key, Set[Key]]

    # Whether the last pop changed the newly top frame on exit
    self.last_pop_changed = False

    self.try_frames = set()  # type: Set[int]
    self.break_frames = []  # type: List[int]
    self.continue_frames = []  # type: List[int]