[Python-bugs-list] [ python-Bugs-500924 ] _POSIX_THREADS not set in pyconfig.h
noreply@sourceforge.net
noreply@sourceforge.net
Sat, 12 Jan 2002 03:16:02 -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: Closed
>Resolution: Fixed
Priority: 7
Submitted By: Konrad Hinsen (hinsen)
Assigned to: Martin v. Löwis (loewis)
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-12 03:16
Message:
Logged In: YES
user_id=21627
Fixed for both Python 2.3 and 2.2. Since <unistd.h> is now
included in Python.h, all other includes are removed.
Revisions for mainline:
Python.h 2.41
_hotshot.c 1.12
bsddbmodule.c 1.31
fcntlmodule.c 2.33
getpath.c 1.41
linuxaudiodev.c 2.17
main.c 1.62
mmapmodule.c 2.36
posixmodule.c 2.218
readline.c 2.42
resource.c 2.20
rgbimgmodule.c 2.23
selectmodule.c 2.60
sgimodule.c 1.17
signalmodule.c 2.61
socketmodule.c 1.202
sunaudiodev.c 1.27
termios.c 2.32
timemodule.c 2.119
fileobject.c 2.143
getpathp.c 1.26
intrcheck.c 2.44
bltinmodule.c 2.247
dynload_beos.c 2.7
frozenmain.c 2.27
import.c 2.193
pythonrun.c 2.154
sysmodule.c 2.99
thread.c 2.40
thread_solaris.h 2.17
For 2.2:
Python.h 2.40.6.1
_hotshot.c 1.11.6.1
bsddbmodule.c 1.30.6.1
fcntlmodule.c 2.31.18.2
getpath.c 1.40.6.1
linuxaudiodev.c 2.16.6.1
main.c 1.61.6.1
mmapmodule.c 2.35.6.1
posixmodule.c 2.216.4.2
readline.c 2.41.6.1
resource.c 2.19.12.1
rgbimgmodule.c 2.22.26.1
selectmodule.c 2.59.6.1
sgimodule.c 1.16.26.1
signalmodule.c 2.60.10.1
socketmodule.c 1.200.6.2
sunaudiodev.c 1.26.6.1
termios.c 2.31.18.1
timemodule.c 2.118.6.1
fileobject.c 2.141.6.1
getpathp.c 1.25.12.1
intrcheck.c 2.43.24.1
bltinmodule.c 2.246.4.1
dynload_beos.c 2.6.6.1
frozenmain.c 2.26.16.1
import.c 2.192.6.1
pythonrun.c 2.153.6.1
sysmodule.c 2.98.6.1
thread.c 2.39.10.1
thread_solaris.h 2.16.10.1
----------------------------------------------------------------------
Comment By: Konrad Hinsen (hinsen)
Date: 2002-01-09 05:32
Message:
Logged In: YES
user_id=11850
Including <unistd.h> in Python.h sounds like a good solution to me. But first of all, please change the comment for _POSIX_THREADS in pyconfig.h. I am probably not the only one to use the Python sources for documentation purposes - contrary to POSIX documents, which I have never seen.
----------------------------------------------------------------------
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