[issue22674] strsignal() missing from signal module

Vajrasky Kok report at bugs.python.org
Sun Oct 26 13:26:40 CET 2014


Vajrasky Kok added the comment:

Here is the preliminary patch. It's a thin wrapper of strsignal.

Some issues and things:
1. About Benjamin Peterson's request, what is the name of the dictionary supposed to be? Is everyone okay with Benjamin's suggestion?

2. About George Brandl's question: "Is it possible to determine the range of signal numbers?" We have a heuristic algorithm:

#ifndef NSIG
# if defined(_NSIG)
#  define NSIG _NSIG            /* For BSD/SysV */
# elif defined(_SIGMAX)
#  define NSIG (_SIGMAX + 1)    /* For QNX */
# elif defined(SIGMAX)
#  define NSIG (SIGMAX + 1)     /* For djgpp */
# else
#  define NSIG 64               /* Use a reasonable default value */
# endif
#endif

if (sig_num < 1 || sig_num >= NSIG) {
        PyErr_SetString(PyExc_ValueError,
                        "signal number out of range");
        return NULL;
}

3. For the unknown signal, what is the description should be? "Unknown signal" like c function returns or None?

4. What is the name of the function that wrap strsignal should be? I use strsignal for now. I just don't think it is appropriate.

----------
keywords: +patch
nosy: +vajrasky
Added file: http://bugs.python.org/file37018/strsignal.patch

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


More information about the Python-bugs-list mailing list