-
-
Notifications
You must be signed in to change notification settings - Fork 35.2k
gh-155321: Avoid Python.h POSIX macro redefinition #155343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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. | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -237,6 +237,15 @@ AH_BOTTOM([ | |
| #define STRICT_SYSV_CURSES /* Don't use ncurses extensions */ | ||
| #endif | ||
|
|
||
| /* Define _POSIX_C_SOURCE only when it was not defined by an earlier | ||
| system-header include. */ | ||
| #ifdef _PYTHON_POSIX_C_SOURCE | ||
| # ifndef _POSIX_C_SOURCE | ||
| # define _POSIX_C_SOURCE 202405L | ||
| # endif | ||
| # undef _PYTHON_POSIX_C_SOURCE | ||
| #endif | ||
|
|
||
| #endif /*Py_PYCONFIG_H*/ | ||
| ]) | ||
|
|
||
|
|
@@ -930,8 +939,8 @@ then | |
| AC_DEFINE([_XOPEN_SOURCE_EXTENDED], [1], | ||
| [Define to activate Unix95-and-earlier features]) | ||
|
|
||
| AC_DEFINE([_POSIX_C_SOURCE], [202405L], | ||
| [Define to activate features from IEEE Std 1003.1-2024]) | ||
| AC_DEFINE([_PYTHON_POSIX_C_SOURCE], [1], | ||
| [Define to configure _POSIX_C_SOURCE in pyconfig.h]) | ||
|
Comment on lines
+942
to
+943
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When configuring on a target where Useful? React with 👍 / 👎. |
||
|
|
||
| # Defining _POSIX_C_SOURCE and _XOPEN_SOURCE hides C23 library | ||
| # declarations on FreeBSD (e.g. sinpi() in math.h) when compiling | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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