From f1e81ebc0aab9332a0350ebf1a3e10ea68ae6377 Mon Sep 17 00:00:00 2001 From: Sergey Lavrinenko Date: Tue, 31 Mar 2026 00:47:24 +0300 Subject: [PATCH] Fix incorrect isinstance check in parse_name_and_email_list The condition on line 134 was checking `isinstance(e, string_types)` twice instead of checking `n` in the second test. This caused the name type validation to be silently skipped. Fixes #167 --- emails/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emails/utils.py b/emails/utils.py index cb90a78..a4e5230 100644 --- a/emails/utils.py +++ b/emails/utils.py @@ -131,7 +131,7 @@ def parse_name_and_email_list(elements, encoding='utf-8'): # Let's do some guesses if isinstance(elements, tuple): n, e = elements - if isinstance(e, string_types) and (not n or isinstance(e, string_types)): + if isinstance(e, string_types) and (not n or isinstance(n, string_types)): # It is probably a pair (name, email) return [parse_name_and_email(elements, encoding), ]