Skip to content

Commit 533ce5c

Browse files
fix: add type ignore comments for pyright strict mode
ROOT CAUSE: Pyright strict mode reports partially unknown types when iterating over BaseExceptionGroup.exceptions tuple CHANGES: - Added type: ignore[reportUnknownVariableType] to for loop line - Fixed location of type ignore comment to be on line with error IMPACT: CI pyright checks will now pass FILES MODIFIED: - src/mcp/shared/exceptions.py
1 parent 477ba64 commit 533ce5c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mcp/shared/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def unwrap_task_group_exception(exc: BaseException) -> BaseException:
143143

144144
# Find the first non-cancelled exception
145145
cancelled_exc_class = anyio.get_cancelled_exc_class()
146-
for sub_exc in exc.exceptions:
146+
for sub_exc in exc.exceptions: # type: ignore[reportUnknownVariableType]
147147
if not isinstance(sub_exc, cancelled_exc_class):
148148
# Type narrowing: we know this is not a CancelledError
149149
return sub_exc # type: ignore[reportUnknownVariableType]

0 commit comments

Comments
 (0)