[issue3110] Multiprocessing package build problem on Solaris 10

Martin v. Löwis report at bugs.python.org
Thu Sep 11 11:53:07 CEST 2008


Martin v. Löwis <martin at v.loewis.de> added the comment:

According to POSIX, if no determinate value for SEM_VALUE_MAX can be
given, the actual value should be queried with
sysconf(_SC_SEM_VALUE_MAX), and SEM_VALUE_MAX should not be defined;
this is in particular the case when the value depends on the system
configuration (such as available memory). _POSIX_SEM_VALUE_MAX specifies
the minimum value guaranteed by POSIX.

Now, it is not plausible why SEM_VALUE_MAX should vary by installation,
as it just depends on what integer type is used to represent the
counter. So more likely, Sun wrote its header files at a time when the
spec was not finished, so they didn't want to clutter the global namespace.

IOW, I think the patch is fine as it stands. If you are over-cautious,
you should test whether _SC_SEM_VALUE_MAX is defined, and use sysconf in
that case, and only fall back to _SEM_VALUE_MAX, then
_POSIX_SEM_VALUE_MAX, then fail, if sysconf isn't available.

If you do make this change, please stop using Py_BuildValue to convert a
C int to a Python int; use PyInt_FromLong instead.

----------
keywords:  -needs review
nosy: +loewis

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3110>
_______________________________________


More information about the Python-bugs-list mailing list