Skip to content

Commit 94e5e53

Browse files
committedSep 13, 2022
Bump to libuv 1.43.0
Also added comment about why uvloop getaddrinfo() may behave differently under special cases (IP + TCP/UDP).
1 parent d2deffe commit 94e5e53

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed
 

Diff for: ‎uvloop/dns.pyx

+23
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,29 @@ cdef __static_getaddrinfo_pyaddr(object host, object port,
245245
except Exception:
246246
return
247247

248+
# When the host is an IP while type is one of TCP or UDP, different libc
249+
# implementations of getaddrinfo() behave differently:
250+
# 1. When AI_CANONNAME is set:
251+
# * glibc: returns ai_canonname
252+
# * musl: returns ai_canonname
253+
# * macOS: returns an empty string for ai_canonname
254+
# 2. When AI_CANONNAME is NOT set:
255+
# * glibc: returns an empty string for ai_canonname
256+
# * musl: returns ai_canonname
257+
# * macOS: returns an empty string for ai_canonname
258+
# At the same time, libuv and CPython both uses libc directly, even though
259+
# this different behavior is violating what is in the documentation.
260+
#
261+
# uvloop potentially should be a 100% drop-in replacement for asyncio,
262+
# doing whatever asyncio does, especially when the libc implementations are
263+
# also different in the same way. However, making our implementation to be
264+
# consistent with libc/CPython would be complex and hard to maintain
265+
# (including caching libc behaviors when flag is/not set), therefore we
266+
# decided to simply normalize the behavior in uvloop for this very marginal
267+
# case following the documentation, even though uvloop would behave
268+
# differently to asyncio on macOS and musl platforms, when again the host
269+
# is an IP and type is one of TCP or UDP.
270+
# All other cases are still asyncio-compatible.
248271
if flags & socket_AI_CANONNAME:
249272
if isinstance(host, str):
250273
canon_name = host

0 commit comments

Comments
 (0)
Please sign in to comment.