[ python-Bugs-1017455 ] including Python.h redefines _POSIX_C_SOURCE

SourceForge.net noreply at sourceforge.net
Fri Aug 27 10:57:32 CEST 2004


Bugs item #1017455, was opened at 2004-08-27 10:54
Message generated for change (Comment added) made by jhellan
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1017455&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jon Kåre Hellan (jhellan)
Assigned to: Nobody/Anonymous (nobody)
Summary: including Python.h redefines _POSIX_C_SOURCE

Initial Comment:
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.

----------------------------------------------------------------------

>Comment By: Jon Kåre Hellan (jhellan)
Date: 2004-08-27 10:57

Message:
Logged In: YES 
user_id=268898

I accidentally made this dupe by pressing the browser's
"Back" button. Please disregard.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1017455&group_id=5470


More information about the Python-bugs-list mailing list