From 081c4d8d556c3df1306fb2be7023ae921114c3e0 Mon Sep 17 00:00:00 2001 From: Affan Asrar <105970505+Affanasrar@users.noreply.github.com> Date: Sun, 8 Nov 2026 16:34:50 +0500 Subject: [PATCH] Fix equality check to handle TypeError Handle TypeError in equality comparison. --- h11/_headers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/h11/_headers.py b/h11/_headers.py index 31da3e2..171f7b5 100644 --- a/h11/_headers.py +++ b/h11/_headers.py @@ -108,7 +108,10 @@ def __bool__(self) -> bool: return bool(self._full_items) def __eq__(self, other: object) -> bool: - return list(self) == list(other) # type: ignore + try: + return list(self) == list(other) # type: ignore + except TypeError: + return NotImplemented def __len__(self) -> int: return len(self._full_items)