Skip to content

Commit

Permalink
sage.misc.dev_tools.find_objects_from_name: Ignore lazy imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jun 4, 2023
1 parent 4539910 commit dcaba14
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/sage/misc/dev_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,14 +244,15 @@ def find_objects_from_name(name, module_name=None):
It might be a good idea to move this function into
:mod:`sage.misc.sageinspect`.
"""
from sage.misc.lazy_import import LazyImport

obj = []
for smodule_name, smodule in sys.modules.items():
if module_name and not smodule_name.startswith(module_name):
continue
if hasattr(smodule, '__dict__') and name in smodule.__dict__:
u = smodule.__dict__[name]
if all(v is not u for v in obj):
if not isinstance(u, LazyImport) and all(v is not u for v in obj):
obj.append(u)

return obj
Expand Down

0 comments on commit dcaba14

Please sign in to comment.