Skip to content

Commit 2806e3d

Browse files
fix: handle TypeError in lookup_class_name for Diagram (#1072)
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 c1b36f0 commit 2806e3d

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
@@ -1306,8 +1306,8 @@ def lookup_class_name(name, context, depth=3):
13061306
depth=node["depth"] - 1,
13071307
)
13081308
)
1309-
except ImportError:
1310-
pass # could not import, so do not attempt
1309+
except (ImportError, TypeError):
1310+
pass # could not inspect module members, skip
13111311
return None
13121312

13131313

0 commit comments

Comments
 (0)