Skip to content

Commit 5f2847c

Browse files
fix: handle TypeError in lookup_class_name for Diagram (#1072) (#1317)
When inspect.getmembers() encounters modules with objects that have non-standard __bases__ attributes (like _ClassNamespace from typing internals), it raises TypeError. This caused dj.Diagram(schema) to fail intermittently depending on what modules were imported. Now catches TypeError in addition to ImportError, allowing the search to continue by skipping problematic modules. Fixes #1072 Co-authored-by: Claude Opus 4.5 <[email protected]>
1 parent 3f5b237 commit 5f2847c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/datajoint/table.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,8 +1307,8 @@ def lookup_class_name(name, context, depth=3):
13071307
depth=node["depth"] - 1,
13081308
)
13091309
)
1310-
except ImportError:
1311-
pass # could not import, so do not attempt
1310+
except (ImportError, TypeError):
1311+
pass # could not inspect module members, skip
13121312
return None
13131313

13141314

0 commit comments

Comments
 (0)