From 4c399a93968a65e2e0288bffbb9b7fbf5768e0a1 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Fri, 11 Apr 2025 16:05:52 +0300 Subject: [PATCH 1/2] Fix AttributeError when importing on Python 3.14 --- httpcore/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httpcore/__init__.py b/httpcore/__init__.py index 662b1563..f34b90a9 100644 --- a/httpcore/__init__.py +++ b/httpcore/__init__.py @@ -136,5 +136,5 @@ def __init__(self, *args, **kwargs): # type: ignore __locals = locals() for __name in __all__: - if not __name.startswith("__"): + if not __name.startswith(("__", "SOCKET_OPTION")): setattr(__locals[__name], "__module__", "httpcore") # noqa From 658bcec838a7518b4f11871084a4cc235f8aa4d5 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> Date: Fri, 11 Apr 2025 16:25:02 +0300 Subject: [PATCH 2/2] Comment the SOCKET_OPTION exclusion --- httpcore/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/httpcore/__init__.py b/httpcore/__init__.py index f34b90a9..d2d2c7ed 100644 --- a/httpcore/__init__.py +++ b/httpcore/__init__.py @@ -136,5 +136,6 @@ def __init__(self, *args, **kwargs): # type: ignore __locals = locals() for __name in __all__: + # Exclude SOCKET_OPTION, it causes AttributeError on Python 3.14 if not __name.startswith(("__", "SOCKET_OPTION")): setattr(__locals[__name], "__module__", "httpcore") # noqa