This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: signal.SIGCLD alias is not available on OSX
Type: Stage:
Components: Documentation, Library (Lib), macOS Versions: Python 3.11, Python 3.10, Python 3.9
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, ned.deily, ronaldoussoren, tcaswell
Priority: normal Keywords: patch

Created on 2021-09-20 22:27 by tcaswell, last changed 2022-04-11 14:59 by admin.

Files
File name Uploaded Description Edit
osx_signal_compat.patch tcaswell, 2021-09-20 22:27
Messages (2)
msg402280 - (view) Author: Thomas Caswell (tcaswell) * Date: 2021-09-20 22:27
The module attribute signal.SIGCLD (https://docs.python.org/3/library/signal.html#signal.SIGCLD) is an "archaic" (quoting from the GNU C Library source) alias for signal.SIGCHLD (https://docs.python.org/3/library/signal.html#signal.SIGCHLD). signal.SIGCHLD is documented as being available on unix, and signal.SIGCLD is documented as an alias of signal.SIGCHLD.  

However, it seems that clang does not define the SIGCLD back-compatibility name [1] so the SIGCLD alias is missing on OSX (all the way to at least 2.7) because the clang headers appear to not define the SIGCLD macro and hence the logic in modulesignal.c does not find it, and hence the rest of the tooling in signal.py does not find it.

I am not sure if the correct fix is to document that SIGCLD in only available on linux (which I am not sure is completely correct, maybe "availability is platform dependent, but definitely not on darwin"?) or to add the macro if SIGCHLD is defined and SIGCLD is missing (see attached patch)

[1] SIGCLD is not documented in https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/signal.3.html and not the signal.h that ships with xcode
msg402292 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2021-09-21 08:18
The documentation for the SIG* constants also mentions:

----
SIG*
All the signal numbers are defined symbolically. For example, the hangup signal is defined as signal.SIGHUP; the variable names are identical to the names used in C programs, as found in <signal.h>. The Unix man page for ‘signal()’ lists the existing signals (on some systems this is signal(2), on others the list is in signal(7)). Note that not all systems define the same set of signal names; only those names defined by the system are defined by this module.
----

This is however mentioned halfway through the list of constants.  I'm not sure why this is so, IMHO it would be clearer to move the fragment I quote to the start of the module constants section.

We shouldn't define SIGCLD on platforms that don't have this name available in their libc headers, which includes macOS.  If the fragment above were moved to the start of the section no further updates would be required (IMHO).
History
Date User Action Args
2022-04-11 14:59:50adminsetgithub: 89414
2021-09-24 23:40:59terry.reedysetversions: - Python 3.6, Python 3.7, Python 3.8
2021-09-21 08:19:00ronaldoussorensetnosy: + ronaldoussoren, ned.deily
messages: + msg402292
components: + macOS
2021-09-20 22:27:22tcaswellcreate