Skip to content

Commit 46c2a37

Browse files
committed
Fix runtime type alias for Python 3.9 compatibility
Use typing.Optional instead of X | None syntax in the AddressPair type alias, since it's evaluated at runtime where PEP 604 union syntax requires Python 3.10+.
1 parent 794ba05 commit 46c2a37

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

emails/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from functools import wraps
1111
from io import StringIO, BytesIO
1212
from collections.abc import Callable
13-
from typing import Any, TypeVar
13+
from typing import Any, Optional, TypeVar
1414

1515
import email.charset
1616
from email import generator
@@ -156,7 +156,7 @@ def __call__(self) -> str:
156156

157157

158158
# Type alias for address pairs used throughout the library
159-
AddressPair = tuple[str | None, str | None]
159+
AddressPair = tuple[Optional[str], Optional[str]]
160160

161161

162162
def parse_name_and_email_list(elements: str | tuple[str | None, str] | list[Any] | None,

0 commit comments

Comments
 (0)