We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6cacb3b commit 5260922Copy full SHA for 5260922
src/trio/_socket.py
@@ -169,7 +169,9 @@ def set_custom_socket_factory(
169
# getaddrinfo and friends
170
################################################################
171
172
-_NUMERIC_ONLY = _stdlib_socket.AI_NUMERICHOST | _stdlib_socket.AI_NUMERICSERV
+# AI_NUMERICSERV may be missing on some older platforms, so use it when available.
173
+_NUMERIC_ONLY = _stdlib_socket.AI_NUMERICHOST
174
+_NUMERIC_ONLY |= getattr(_stdlib_socket, "AI_NUMERICSERV", 0)
175
176
177
# It would be possible to @overload the return value depending on Literal[AddressFamily.INET/6], but should probably be added in typeshed first
0 commit comments