[New-bugs-announce] [issue23325] Turn SIG_DFL and SIG_IGN into functions

Serhiy Storchaka report at bugs.python.org
Mon Jan 26 21:38:30 CET 2015


New submission from Serhiy Storchaka:

In C the SIG_DFL and SIG_IGN macros expand into integral expressions that are not equal to an address of any function. In Python they are int objects with platform depended values. Second argument of the signal() function should be SIG_DFL, SIG_IGN, or a function. The getsignal() function returns SIG_DFL, SIG_IGN, None, or a function. They are tested for identity in signal() and getsignal() returns identical values. So actually SIG_DFL and SIG_IGN are just singletons.

I propose to turn SIG_DFL and SIG_IGN into functions. Benefits:

1. They will have names and self-descriptive representation.
2. They will have docstrings.
3. The signature of signal() will be simpler. The type of second argument would be function.
4. Their pickling will be portable.

This patch depends on the backout of turning these constants to enums (issue21076).

----------
components: Library (Lib)
files: signal_std_handlers.patch
keywords: patch
messages: 234775
nosy: ethan.furman, giampaolo.rodola, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Turn SIG_DFL and SIG_IGN into functions
type: enhancement
versions: Python 3.5
Added file: http://bugs.python.org/file37868/signal_std_handlers.patch

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


More information about the New-bugs-announce mailing list