STINNER Victor added the comment:
signal constants are now enum, I close the issue. For further enhancements,
please open a separated issue.
$ python3
Python 3.8.3 (default, May 15 2020, 00:00:00)
>>> import signal; signal.SIGTERM
--
resolution: -> fixed
stage: patch review ->
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: -ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
___
___
Python-bugs-list
Ethan Furman added the comment:
Okay, in a perfect world that _enum_to_int function would be unnecessary, but
as Serhiy pointed out the C code is doing pointer comparison, so unless the
exact same int is passed in it does not work.
I'm looking at adjusting the C code.
--
Ethan Furman added the comment:
Working on issue23673 I saw this in the new signal.py:
+def _enum_to_int(value):
+Convert an IntEnum member to a numeric value.
+If it's not a IntEnum member return the value itself.
+
+try:
+return int(value)
+except (ValueError,
Ethan Furman added the comment:
Removing the 'enum_to_int' function would also take care of the accepting
inappropriate types problem.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
Ethan Furman added the comment:
I know nothing about this part of CPython, but wouldn't the correct solution be
to not compare by identity?
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
Serhiy Storchaka added the comment:
And more, as far as standard signal handler is tested for identity,
signal.SIG_DFL and _signal.SIG_DFL should be the same object. Current code
works only due to coincidence of two circumstances:
1) Small integers are cached in CPython.
2) SIG_DFL and
Serhiy Storchaka added the comment:
I have other proposition -- turn them into functions (issue23325).
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
___
Serhiy Storchaka added the comment:
Now signal.signal() accepts inappropriate types.
signal.signal(signal.SIGHUP, 0.0)
Handlers.SIG_DFL: 0
signal.signal(signal.SIGHUP, '0')
Handlers.SIG_DFL: 0
In 3.4 it raised an exception.
--
status: closed - open
Serhiy Storchaka added the comment:
And more:
import signal
signal.signal(1.2, signal.SIG_DFL)
Handlers.SIG_DFL: 0
signal.signal('1', signal.SIG_DFL)
Handlers.SIG_DFL: 0
--
___
Python tracker rep...@bugs.python.org
Roundup Robot added the comment:
New changeset c9239171e429 by Giampaolo Rodola' in branch 'default':
fix #21076: turn signal module constants into enums
http://hg.python.org/cpython/rev/c9239171e429
--
nosy: +python-dev
___
Python tracker
Serhiy Storchaka added the comment:
http://buildbot.python.org/all/builders/AMD64%20Ubuntu%20LTS%203.x/builds/4131/steps/compile/logs/stdio
gcc -pthread -Xlinker -export-dynamic -o Modules/_testembed
Modules/_testembed.o libpython3.5dm.a -lpthread -ldl -lutil -lm
Roundup Robot added the comment:
New changeset df5120efb86e by Victor Stinner in branch 'default':
Issue #21076: the C signal module has been renamed to _signal
http://hg.python.org/cpython/rev/df5120efb86e
--
___
Python tracker
Roundup Robot added the comment:
New changeset b1f5b5d7997f by Victor Stinner in branch 'default':
Issue #21076: sigpending() is not available on Windows
http://hg.python.org/cpython/rev/b1f5b5d7997f
--
___
Python tracker rep...@bugs.python.org
Changes by Giampaolo Rodola' g.rod...@gmail.com:
--
assignee: - giampaolo.rodola
resolution: - fixed
stage: patch review - committed/rejected
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
Giampaolo Rodola' added the comment:
If there are no other concerns I will commit latest patch tomorrow, then do the
renaming.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
___
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):
Giampaolo Rodola' added the comment:
New patch in attachment provides 3 enum containers and overrides all the
necessary signal module APIs so that they interoperate with enums on both get
and set.
I decided *not* to rename signamodule.c to _signamodule.c in this patch so that
it is easier to
Giampaolo Rodola' added the comment:
Updated patch following Victor's suggestions is in attachment.
--
Added file: http://bugs.python.org/file34655/signals4.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
New submission from Giampaolo Rodola':
Relevant discussion + BDFL approval:
https://mail.python.org/pipermail/python-ideas/2014-March/027286.html
Patch (not tested on Windows) is in attachment.
--
components: Library (Lib)
files: signals.patch
keywords: patch
messages: 214959
nosy:
Changes by Giampaolo Rodola' g.rod...@gmail.com:
Added file: http://bugs.python.org/file34637/signals.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
___
Changes by Giampaolo Rodola' g.rod...@gmail.com:
Removed file: http://bugs.python.org/file34637/signals.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
___
Guido van Rossum added the comment:
OK, somebody please review this (not me).
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
___
___
Changes by Guido van Rossum gu...@python.org:
--
stage: - patch review
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
___
___
Changes by Ethan Furman et...@stoneleaf.us:
--
nosy: +ethan.furman
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
___
___
Python-bugs-list
Charles-François Natali added the comment:
This patch can't be reviewed: please re-generate without --git.
--
nosy: +neologix
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
___
Changes by STINNER Victor victor.stin...@gmail.com:
--
nosy: +haypo
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
___
___
Python-bugs-list
Changes by Giampaolo Rodola' g.rod...@gmail.com:
Added file: http://bugs.python.org/file34640/signals.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
___
Changes by Giampaolo Rodola' g.rod...@gmail.com:
Removed file: http://bugs.python.org/file34640/signals.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
___
Changes by Giampaolo Rodola' g.rod...@gmail.com:
Added file: http://bugs.python.org/file34642/signals.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
___
Giampaolo Rodola' added the comment:
This time I made it without --git but that didn't help either.
Not sure what to do. :-\
Note: the devguide recommends using --git BTW:
http://docs.python.org/devguide/committing.html
Should that be changed?
--
Changes by Giampaolo Rodola' g.rod...@gmail.com:
Removed file: http://bugs.python.org/file34642/signals.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
___
Changes by Giampaolo Rodola' g.rod...@gmail.com:
Added file: http://bugs.python.org/file34643/signals2.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
___
Giampaolo Rodola' added the comment:
OK, it appears it works now. Sorry for the notification noise.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21076
___
34 matches
Mail list logo