This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author RAW
Recipients RAW
Date 2013-02-04.05:39:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The header file pyconfig.h mishandles the _POSIX_C_SOURCE and _XOPEN_SOURCE preprocessor macros.

For older versions of Python, the pyconfig.h header specifies:

#define _POSIX_C_SOURCE 200112L


#define _XOPEN_SOURCE 600

For newer versions of Python, the pyconfig.h header specifies:

#define _POSIX_C_SOURCE 200809L


#define _XOPEN_SOURCE 700

The Open Group has documentation about these symbols:

In particular, the documentation states:

A POSIX-conforming application should ensure that the feature test macro _POSIX_C_SOURCE is defined before inclusion of any header.

So, having a header file attempting to set _POSIX_C_SOURCE violates this intention.

Yes, I am well aware that the Python documentation says to include Python.h before any standard headers are included.  However, this is still problematic.

In particular, it causes trouble for source code that wishes to include the Python headers and wishes to use declarations that are made visible by setting later values for _POSIX_C_SOURCE and _XOPEN_SOURCE.

I would suggest the pyconfig.h be updated to have something like this:

#if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L
#warning Python expects -D_POSIX_C_SOURCE=200112L or later
#define _POSIX_C_SOURCE 200112L

and this:

#if !defined(_XOPEN_SOURCE) || _XOPEN_SOURCE < 600
#warning Python expects -D_XOPEN_SOURCE=600 or later
#define _XOPEN_SOURCE 600
Date User Action Args
2013-02-04 05:39:07RAWsetrecipients: + RAW
2013-02-04 05:39:07RAWsetmessageid: <>
2013-02-04 05:39:07RAWlinkissue17120 messages
2013-02-04 05:39:06RAWcreate