fix: handle TypeError in lookup_class_name for Diagram#1317
Merged
dimitri-yatsenko merged 1 commit intopre/v2.0from Jan 9, 2026
Merged
fix: handle TypeError in lookup_class_name for Diagram#1317dimitri-yatsenko merged 1 commit intopre/v2.0from
dimitri-yatsenko merged 1 commit intopre/v2.0from
Conversation
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 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes intermittent
TypeErrorwhen generating diagrams withdj.Diagram(schema).Problem
dj.Diagram(schema)could fail with:This occurred when
inspect.getmembers()encountered modules containing objects with non-standard__bases__attributes (like_ClassNamespacefrom typing internals).Root Cause
In
lookup_class_name(), onlyImportErrorwas caught:Fix
Catch
TypeErrorin addition toImportError:Impact
Closes
🤖 Generated with Claude Code