Skip to content

Mark test using inet_ntoa as thread-unsafe#252

Open
ngoldbaum wants to merge 1 commit into
python-cffi:mainfrom
ngoldbaum:fix-cffi-flaky-test
Open

Mark test using inet_ntoa as thread-unsafe#252
ngoldbaum wants to merge 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.

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.

1 participant