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.

classification
Title: including Python.h redefines _POSIX_C_SOURCE
Type: Stage:
Components: None Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: jhellan
Priority: normal Keywords:

Created on 2004-08-27 08:54 by jhellan, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg22237 - (view) Author: Jon Kåre Hellan (jhellan) Date: 2004-08-27 08:54
Consider this program:

#include <limits.h>
#include <Python.h>

int main (int arg, char **argv)
{
	return 0;
}

We compile it like this

cc -Wall -I/usr/include/python2.3 -c aa.c

And get

In file included from /usr/include/python2.3/Python.h:8,
                 from aa.c:3:
/usr/include/python2.3/pyconfig.h:853:1: warning:
"_POSIX_C_SOURCE" redefined
In file included from /usr/include/limits.h:26,
                 from
/usr/lib/gcc-lib/i486-linux/3.3.4/include/limits.h:122,
                 from
/usr/lib/gcc-lib/i486-linux/3.3.4/include/syslimits.h:7,
                 from
/usr/lib/gcc-lib/i486-linux/3.3.4/include/limits.h:11,
                 from aa.c:2:
/usr/include/features.h:171:1: warning: this is the
location of the previous definition

Python.h has redefind a symbol which got defined by
including 
limits.h. This is unfriendly to programs which embed
Python. 

I suspect that there are definitions in pyconfig.h
which are only
relevant when building the Python distribution. Such
definitions 
should not be exposed to embedders or builders of 3rd
party modules.

I can make the warning go away by including Python.h
first. But my application has its own config.h -
strange that Python's has to go
in front of it.
msg22238 - (view) Author: Jon Kåre Hellan (jhellan) Date: 2004-08-27 08:57
Logged In: YES 
user_id=268898

I accidentally made this dupe by pressing the browser's
"Back" button. Please disregard.
History
Date User Action Args
2022-04-11 14:56:06adminsetgithub: 40832
2004-08-27 08:54:33jhellancreate