Skip to content

Commit

Permalink
update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
HAOCHENYE committed Apr 27, 2023
1 parent 196616f commit 60ebd01
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mmengine/registry/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,10 @@ def _register_module(self,
existed_module = self.module_dict[name]
raise KeyError(f'{name} is already registered in {self.name} '
f'at {existed_module.__module__}')
# If module is a partial function or user defined callable
# object, it may not have `__module__` and `__name__` attributes.
# We set the `__module__` and `__name__` attributes for them to
# provide more information.
if not hasattr(module, '__module__'):
module_name = str(inspect.getmodule(sys._getframe(2)))
if module_name is None:
Expand Down

0 comments on commit 60ebd01

Please sign in to comment.