[ python-Bugs-1017450 ] including Python.h redefines _POSIX_C_SOURCE
SourceForge.net
noreply at sourceforge.net
Sat Sep 4 18:52:07 CEST 2004
Bugs item #1017450, was opened at 2004-08-27 10:43
Message generated for change (Comment added) made by loewis
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1017450&group_id=5470
Category: None
Group: None
>Status: Closed
>Resolution: Invalid
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: Martin v. Löwis (loewis)
Date: 2004-09-04 18:52
Message:
Logged In: YES
user_id=21627
Your program is in error - it must not include limits.h
before including Python.h, see
http://docs.python.org/api/includes.html
The defines in Python.h *can* affect the code in the
extension module, e.g. they might affect the size of off_t.
Extensions which don't follow this rule may crash.
----------------------------------------------------------------------
Comment By: Jon Kåre Hellan (jhellan)
Date: 2004-08-27 10:56
Message:
Logged In: YES
user_id=268898
Sorry about the duplicate. That was my browser's "back" button.
Platform is Debian sid (soon to be sarge), and Python
version is 2.3.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1017450&group_id=5470
More information about the Python-bugs-list
mailing list