serhiy-storchaka · GitHub

Bug report

Bug description

On Solaris and illumos, socket.sendmsg, recvmsg, and the CMSG_* macros aren't available:

>>> import socket; hasattr(socket.socket, 'sendmsg')
False
>>> import multiprocessing; multiprocessing.get_all_start_methods()
['fork', 'spawn']          # no 'forkserver'

Consequently multiprocessing.reduction.HAVE_SEND_HANDLE is False and the forkserver start method is unavailable (forkserver passes worker file descriptors over a Unix socket via sendmsg+SCM_RIGHTS). This makes test_socket ancillary-data tests and forkserver-based test_multiprocessing_forkserver / test_concurrent_futures tests fail or error.

Cause

On Solaris the ancillary-data API is declared only when _XOPEN_SOURCE >= 600 (XPG6). But configure.ac deliberately leaves _XOPEN_SOURCE undefined on Solaris (relying on __EXTENSIONS__), because historically _XOPEN_SOURCE hid other features there (bpo-1759169). So the socket module builds without sendmsg/recvmsg. This exact problem was reported in gh-57208 (2011) and closed unresolved.

Fix

Define _XOPEN_SOURCE=600 on Solaris. __EXTENSIONS__ (now reliably defined by AC_USE_SYSTEM_EXTENSIONS) re-enables the platform features _XOPEN_SOURCE would otherwise hide — the same combination the OpenIndiana system Python already builds with (-D_XOPEN_SOURCE=600 -D__EXTENSIONS__=1 -D_XPG6). Verified on OpenIndiana (illumos) 2026: sendmsg/recvmsg/CMSG_* are built, forkserver becomes available, the full build is clean, and the affected test suites pass.

Linked PRs

Read the original on github.com ↗