Fix KeyError constructing groups when no module is present

This commit is contained in:
Lilly Rose Berner
2022-08-30 06:53:05 +02:00
committed by GitHub
parent 64744a4938
commit 2d180489ce

View File

@ -1577,7 +1577,7 @@ class Group:
# This is pretty hacky
# It allows the module to be fetched if someone just constructs a bare Group object though.
self.module = inspect.currentframe().f_back.f_globals['__name__'] # type: ignore
except (AttributeError, IndexError):
except (AttributeError, IndexError, KeyError):
self.module = None
self._children: Dict[str, Union[Command, Group]] = {}