def METHOD_NAME(self, module: ModuleType) -> None:
    name = ""
    try:
        if module.__spec__:
            name = module.__spec__.name
    except Exception:
        pass
    if not name:
        name = module.__name__
    super().METHOD_NAME(module)
    if sys.modules.get(name):
        self.module_cache[name] = sys.modules[name]
        for alias in self.module_aliases:
            if sys.modules.get(alias) is not sys.modules[name]:
                sys.modules[alias] = sys.modules[name]
    parent_name = name.rpartition(".")[0]
    if parent_name:
        try:
            parent = sys.modules[parent_name]
            names = [alias.rpartition(".")[2] for alias in self.module_aliases]
            for tail_name in names:
                if tail_name in parent.__dict__:
                    parent.__dict__.pop(tail_name)
                parent.__dict__[tail_name] = WeakReference()
                finalize(parent.__dict__[tail_name], _finalize_callback, parent, names)
        except KeyError:
            pass