[issue21076] Turn signal.SIG* constants into enums

Giampaolo Rodola' report at bugs.python.org
Fri Mar 28 13:52:09 CET 2014


Giampaolo Rodola' added the comment:

(replying here 'cause rietveld keeps giving me an exception when I submit a reply)

On 2014/03/28 00:49:47, haypo wrote:
> http://bugs.python.org/review/21076/diff/11457/Lib/signal.py
> File Lib/signal.py (right):
> 
> http://bugs.python.org/review/21076/diff/11457/Lib/signal.py#newcode7
> Lib/signal.py:7: if name.isupper()
> You can probably remove this test.
> 
> http://bugs.python.org/review/21076/diff/11457/Lib/signal.py#newcode8
> Lib/signal.py:8: and (name.startswith('SIG') and not name.startswith('SIG_'))
> Why do you ignore SIG_DFL, SIG_IGN, SIG_BLOCK, SIG_UNBLOCK, SIG_SETMASK? It may
> also be interesting to provide enums for them. They are just integers (0, 1 or
> 2) on my Linux.

I guess it makes sense.
I'm now realizing that the patch as-is is incomplete as the other "get" APIs (signal.getsignal() and others) still return integers: they should be overridden in order to convert integers into enums, similarly to http://hg.python.org/cpython/file/d8659dbebfd1/Lib/socket.py#l262
I will do that.

----------

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


More information about the Python-bugs-list mailing list