gh-155321: Avoid Python.h POSIX macro redefinition - #155343
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 69983c8e10
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| AC_DEFINE([_PYTHON_POSIX_C_SOURCE], [1], | ||
| [Define to configure _POSIX_C_SOURCE in pyconfig.h]) |
There was a problem hiding this comment.
Preserve the POSIX macro during configure probes
When configuring on a target where _XOPEN_SOURCE alone does not expose the required POSIX declarations—specifically Tru64 and some HP-UX cases called out immediately above—this replacement leaves only _PYTHON_POSIX_C_SOURCE in confdefs.h; the conditional that turns it into _POSIX_C_SOURCE exists only in the generated pyconfig.h. Consequently, all subsequent configure header/function probes run without the required feature-test macro and can record false-negative HAVE_* results, even though the actual Python build later sees _POSIX_C_SOURCE=202405L. Preserve the real macro for configure test compilations while using the marker only for generating the guarded public-header definition.
Useful? React with 👍 / 👎.
| @@ -0,0 +1,2 @@ | |||
| Allow :file:`Python.h` to be included after system headers that define | |||
| ``_POSIX_C_SOURCE`` without causing a macro redefinition diagnostic. | |||
There was a problem hiding this comment.
I think the filename should follow the naming convention of other news entries. In particular, the timestamp should be the actual time rather than a zero timestamp, and the final part should be a random string
Blurb and blurb-it are the recommended tools for generating news entries. See: https://devguide.python.org/getting-started/pull-request-lifecycle/#how-to-add-a-news-entry
Fixes #155321.
Summary:
Tests: