[issue22674] strsignal() missing from signal module

2017-10-12 Thread Antoine Pietri

Antoine Pietri  added the comment:

Hey everyone,

We would like to have that feature for a project where we have to use ctypes to 
achieve that. I don't know the answers to vajrasky's questions but I just 
wanted to chime in to say having this feature would be greatly appreciated. I 
can also work on the code if you need any help.

Thanks!

--
nosy: +antoine.pietri

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22674] strsignal() missing from signal module

2014-10-26 Thread Vajrasky Kok

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 rep...@bugs.python.org
http://bugs.python.org/issue22674
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22674] strsignal() missing from signal module

2014-10-20 Thread Georg Brandl

Georg Brandl added the comment:

Is it possible to determine the range of signal numbers?  Otherwise it would be 
a guessing game where to stop querying when filling up the dictionary.

A problem is also that if the signal number is not valid, the return value of 
strsignal() is unspecified, *and* there is no way to check for this situation 
because no errors are defined.

--
nosy: +georg.brandl

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22674
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22674] strsignal() missing from signal module

2014-10-20 Thread STINNER Victor

STINNER Victor added the comment:

I don't think that a strsignal() is required, signals now have a name attribute!

Python 3.5.0a0 (default:07ae7bc06af0, Oct 16 2014, 09:46:01) 
 import signal
 signal.SIGINT
Signals.SIGINT: 2
 signal.SIGINT.name
'SIGINT'

--
nosy: +haypo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22674
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22674] strsignal() missing from signal module

2014-10-20 Thread Georg Brandl

Georg Brandl added the comment:

Nice. However, strsignal() returns not just SIGINT, but Interrupted etc.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22674
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22674] strsignal() missing from signal module

2014-10-19 Thread Dolda2000

New submission from Dolda2000:

Like it says on the tin, it would be nice if strsignal(3) were added to the 
signal module.

--
components: Library (Lib)
messages: 229691
nosy: Dolda2000
priority: normal
severity: normal
status: open
title: strsignal() missing from signal module
type: enhancement
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22674
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22674] strsignal() missing from signal module

2014-10-19 Thread R. David Murray

R. David Murray added the comment:

This seems like a reasonable request to me.  Do you want to propose a patch?

--
nosy: +r.david.murray
versions: +Python 3.5 -Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22674
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22674] strsignal() missing from signal module

2014-10-19 Thread Benjamin Peterson

Benjamin Peterson added the comment:

A dictionary, signal number - signal name might be more friendly.

--
nosy: +benjamin.peterson

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22674
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue22674] strsignal() missing from signal module

2014-10-19 Thread R. David Murray

R. David Murray added the comment:

Yeah, the thinnest possible exposure of the strsignal API wouldn't really be 
that sensible for Python.  But making the OS information available *somehow* 
makes sense.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22674
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com