Skip to content

Fix equality check to handle TypeError - #216

Open
Affanasrar wants to merge 1 commit into
python-hyper:masterfrom
Affanasrar:fix-headers-equality-typeerror
Open

Affanasrar wants to merge 1 commit into
python-hyper:masterfrom
Affanasrar:fix-headers-equality-typeerror

Conversation

@Affanasrar

Copy link
Copy Markdown

Fixes #214

Root Cause

Headers.eq called list(other) directly without handling non-iterable types. When comparing against a non-iterable operand (such as None or unittest.mock.ANY), list(other) raised TypeError instead of returning NotImplemented to allow Python's equality fallback.

Fix

Wrapped the list comparison in a try-except TypeError block in Headers.eq to return NotImplemented when other is non-iterable.