From 2806e3d923029eac7bcf6f867f62bdfa2f4c9d7e Mon Sep 17 00:00:00 2001 From: Dimitri Yatsenko Date: Thu, 8 Jan 2026 21:44:07 -0600 Subject: [PATCH] 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 --- src/datajoint/table.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/datajoint/table.py b/src/datajoint/table.py index 7543c385e..510b78d47 100644 --- a/src/datajoint/table.py +++ b/src/datajoint/table.py @@ -1306,8 +1306,8 @@ def lookup_class_name(name, context, depth=3): depth=node["depth"] - 1, ) ) - except ImportError: - pass # could not import, so do not attempt + except (ImportError, TypeError): + pass # could not inspect module members, skip return None