Skip to content

Commit

Permalink
core: add flexible member to ares_addrinfo to fix c-ares 1.18
Browse files Browse the repository at this point in the history
Add a flexible member to account for c-ares 1.18 adding an additional
`name` member to `struct ares_addrinfo`.  This fixes the following
exception from cffi, and the resulting test_getaddrinfo* failures:

```
Exception ignored from cffi callback <function _addrinfo_cb at 0x7f5fa890d040>:
Traceback (most recent call last):
  File "/tmp/pycares/.tox/py39/lib/python3.9/site-packages/pycares/__init__.py", line 162, in _addrinfo_cb
    result = ares_addrinfo_result(res)
  File "/tmp/pycares/.tox/py39/lib/python3.9/site-packages/pycares/__init__.py", line 841, in __init__
    cname_ptr = ares_addrinfo.cnames
ffi.error: struct ares_addrinfo: wrong total size (cdef says 16, but C compiler says 24). fix it or use "...;" as the last field in the cdef for struct ares_addrinfo to make it flexible
```
  • Loading branch information
mgorny authored and saghul committed Jun 22, 2022
1 parent 7d62675 commit ad6ad95
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/_cffi_src/build_cares.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@
struct ares_addrinfo {
struct ares_addrinfo_cname *cnames;
struct ares_addrinfo_node *nodes;
...;
};
struct ares_addrinfo_hints {
Expand Down

0 comments on commit ad6ad95

Please sign in to comment.