Skip to content

Mark test using inet_ntoa as thread-unsafe#252

Merged
mattip merged 1 commit into
python-cffi:mainfrom
ngoldbaum:fix-cffi-flaky-test
Jul 3, 2026
Merged

Mark test using inet_ntoa as thread-unsafe#252
mattip merged 1 commit into
python-cffi:mainfrom
ngoldbaum:fix-cffi-flaky-test

Conversation

@ngoldbaum

@ngoldbaum ngoldbaum commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

I saw this failure in the CI for #250. I managed to trigger it locally on my Mac by looping that one test for a few dozen test runs.

This issue is explicitly called out in the BUGS section of the darwin inet_ntoa manpage: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/inet_ntoa.3.html

This isn't a problem with glibc because inet_ntoa returns a thread-local string there but it is a problem for musl which also returns a static string.

Rather than trying to parse exactly what situations allow you to use this API with threads, I've just marked the test unconditionally thread-unsafe.

While I was touching this code, I also moved the win32 skip to a static skipif decorator, which is generally preferred over a runtime check in the test body.

@mattip mattip merged commit 9f04d85 into python-cffi:main Jul 3, 2026
38 checks passed
@mattip

mattip commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Thanks @ngoldbaum

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants