# Buggy code
def update_from_options(self, frames: List[Frame]) -> bool:
    """Update the frame to reflect that each key will be updated
    as in one of the frames.  Return whether any item changes.

    If a key is declared as AnyType, only update it if all the
    options are the same.
    """

    changed = False
    keys = set(key for f in frames for key in f)

    for key in keys:
        current_value = self._get(key)
        resulting_values = [f.get(key, current_value) for f in frames]
        if any(x is None for x in resulting_values):
            continue

        if isinstance(self.declarations.get(key), AnyType):
            type = resulting_values[0]
            if not all(is_same_type(type, t) for t in resulting_values[1:]):
                type = AnyType()
        else:
            type = resulting_values[0]
            for other in resulting_values[1:]:
                type = join_simple(self.declarations[key], type, other)
        if not is_same_type(type, current_value):
            self._push(key, type)
            changed = True

    return changed


# 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 update_from_options(self, frames: List[Frame]) -> bool:
    """Update the frame to reflect that each key will be updated
    as in one of the frames.  Return whether any item changes.

    If a key is declared as AnyType, only update it if all the
    options are the same.
    """

    frames = [f for f in frames if not f.unreachable]
    changed = False
    keys = set(key for f in frames for key in f)

    for key in keys:
        current_value = self._get(key)
        resulting_values = [f.get(key, current_value) for f in frames]
        if any(x is None for x in resulting_values):
            # We didn't know anything about key before
            # (current_value must be None), and we still don't
            # know anything about key in at least one possible frame.
            continue

        if isinstance(self.declarations.get(key), AnyType):
            type = resulting_values[0]
            if not all(is_same_type(type, t) for t in resulting_values[1:]):
                type = AnyType()
        else:
            type = resulting_values[0]
            for other in resulting_values[1:]:
                type = join_simple(self.declarations[key], type, other)
        if not is_same_type(type, current_value):
            self._push(key, type)
            changed = True

    self.frames[-1].unreachable = not frames

    return changed