[Python-bugs-list] [ python-Bugs-500924 ] _POSIX_THREADS not set in pyconfig.h

noreply@sourceforge.net noreply@sourceforge.net
Tue, 08 Jan 2002 21:36:54 -0800


Bugs item #500924, was opened at 2002-01-08 09:35
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=500924&group_id=5470

Category: Build
Group: Python 2.2.1 candidate
Status: Open
Resolution: None
Priority: 7
Submitted By: Konrad Hinsen (hinsen)
Assigned to: Nobody/Anonymous (nobody)
Summary: _POSIX_THREADS not set in pyconfig.h

Initial Comment:
When building Python 2.2 under Linux (RedHat 7.1), _POSIX_THREADS remains undefined in pyconfig.h although Posix threads are used. In Python 2.1 it was still set.

I haven't found any adverse effects in Python itself, but threaded extension modules that make pthread calls don't compile.


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

>Comment By: Martin v. Löwis (loewis)
Date: 2002-01-08 21:36

Message:
Logged In: YES 
user_id=21627

Including <unistd.h> in Python.h should be possible. Of
course, it may lead to breakage of existing extensions,
since unistd.h may drag in (almost) arbitrary additional
#defines and other global names, which could then confuse
the extension code.

One may argue that any such extension code would be already
incorrect if it cannot stand inclusion of <unistd.h> on
Unix. So the risk should be very small.

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-01-08 14:05

Message:
Logged In: YES 
user_id=6380

Can't we #include <unistd.h> in Python.h, if it exists?

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

Comment By: Martin v. Löwis (loewis)
Date: 2002-01-08 13:55

Message:
Logged In: YES 
user_id=21627

This is not a bug in Python, but in the extension modules.
According to POSIX, an implementation (i.e. OS and C
compiler) shall define _POSIX_THREADS in <unistd.h> if
threads are supported. 

Python 2.1 was always defining this, which was an error
because it might have conflicted with the operating system
settings. Python 2.2 only defines it if it finds a specific
bug in the implementation: namely, if the system provides
posix threads, but does not declare so in unistd.h.

So the bug is in the extension modules: they must include
<unistd.h> to get _POSIX_THREADS. It is safe to include
<unistd.h> after including Python.h and checking HAVE_UNISTD_H.

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-01-08 12:13

Message:
Logged In: YES 
user_id=6380

I don't know anything about this area of life, but I surmise
it's a bug that ought to be fixed before we release 2.2.1,
hence I'm setting the priority to 7.

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

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