Skip to content

include Python.h first#246

Merged
dimpase merged 4 commits intosagemath:mainfrom
cxzhong:patch-2
Apr 11, 2026
Merged

include Python.h first#246
dimpase merged 4 commits intosagemath:mainfrom
cxzhong:patch-2

Conversation

@cxzhong
Copy link
Copy Markdown
Contributor

@cxzhong cxzhong commented Apr 6, 2026

It seems CPython document said

Note Since Python may define some pre-processor definitions which affect the standard headers on some systems, you must include Python.h before any standard headers are included.
It is recommended to always define PY_SSIZE_T_CLEAN before including Python.h. See [Parsing arguments and building values](https://docs.python.org/3/c-api/arg.html#arg-parsing) for a description of this macro.

@cxzhong cxzhong marked this pull request as ready for review April 6, 2026 08:52
@cxzhong cxzhong requested a review from tornaria April 6, 2026 09:17
@cxzhong cxzhong closed this Apr 6, 2026
Remove PY_SSIZE_T_CLEAN definition from implementation.c
@cxzhong cxzhong reopened this Apr 6, 2026
@tornaria
Copy link
Copy Markdown
Member

tornaria commented Apr 6, 2026

I don't know what is broken without this, but ok.

@cxzhong
Copy link
Copy Markdown
Contributor Author

cxzhong commented Apr 6, 2026

I also do not find something is broken, but in the document, Python.h is included first, then system headers, standard libs are included

@dimpase dimpase merged commit 5e1a3ea into sagemath:main Apr 11, 2026
19 of 25 checks passed
@cxzhong cxzhong deleted the patch-2 branch April 11, 2026 06:06
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.

3 participants