Commit ff6435a
gh-145688: Use identity check instead of name+module allowlist
Per @AlexWaygood's review, checking base.__module__ in {'typing',
'typing_extensions'} is fragile and would break third-party libraries
like beartype that define their own Protocol using _ProtocolMeta.
Use `base is Protocol or base is Generic` instead, which is the same
pattern already used at line 1176 in _generic_class_getitem. This
precisely targets the two base classes we want to skip without
affecting any third-party Protocol implementations.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent 42c3750 commit ff6435a
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1884 | 1884 | | |
1885 | 1885 | | |
1886 | 1886 | | |
1887 | | - | |
| 1887 | + | |
1888 | 1888 | | |
1889 | 1889 | | |
1890 | 1890 | | |
| |||
0 commit comments