Skip to content

gh-154136: Define _ISOC23_SOURCE to fix building the math module on FreeBSD#154138

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:math-pi-decl
Jul 20, 2026
Merged

gh-154136: Define _ISOC23_SOURCE to fix building the math module on FreeBSD#154138
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:math-pi-decl

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jul 19, 2026

Copy link
Copy Markdown
Member

On FreeBSD, libm provides cospi, sinpi and tanpi, but math.h declares them only for C23, and defining _POSIX_C_SOURCE and _XOPEN_SOURCE reduces header visibility to C11. The link-only AC_CHECK_FUNCS test still finds the symbols, so compiling Modules/mathmodule.c failed.

Defining _ISOC23_SOURCE makes the declarations visible, so the native libm implementations are detected and used. On other platforms it is a no-op.

🤖 Generated with Claude Code

…e on FreeBSD

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@skirpichev skirpichev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume, that platforms libm is "good enough" (i.e. to pass our tests).

Probably we could replace AC_CHECK_FUNCS* with a different check, but current solution looks sufficiently safe for me.

@serhiy-storchaka

Copy link
Copy Markdown
Member Author

Claude first proposed to replace AC_CHECK_FUNCS* with a different check, but this would left FreeBSD using the fallback implementation, even if they are available in the libm. I chose different minimal solution.

@serhiy-storchaka
serhiy-storchaka merged commit 44ea950 into python:main Jul 20, 2026
57 checks passed
@serhiy-storchaka
serhiy-storchaka deleted the math-pi-decl branch July 20, 2026 05:00
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