[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2020-03-09 Thread STINNER Victor


STINNER Victor  added the comment:

I marked bpo-24415 as duplicate of this issue.

--

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-03 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

So this is in 2.7 finally.  Closing again.

--
stage: patch review -> resolved
status: open -> closed
versions: +Python 2.7

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-03 Thread Antoine Pitrou


Antoine Pitrou  added the comment:


New changeset ded666ff0ce44785a495ff89b676ca68e4cc08e8 by Antoine Pitrou in 
branch '2.7':
[2.7] bpo-30654: Do not reset SIGINT handler to SIG_DFL in finisignal (GH-7146) 
(GH-7347)
https://github.com/python/cpython/commit/ded666ff0ce44785a495ff89b676ca68e4cc08e8


--

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-02 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
pull_requests: +6973
stage: resolved -> patch review

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-02 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Reopening for the 2.7 backport discussion.

--
status: closed -> open

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-02 Thread STINNER Victor


STINNER Victor  added the comment:

IMHO it's a bugfix.

--

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-02 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Short of any bug in the patch, yes, it's stricly an improvement.

--

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-01 Thread Benjamin Peterson


Benjamin Peterson  added the comment:

It seems like this only affects embeddings and for embeddings, it's strictly an 
improvement?

--

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-01 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

I'm nosy'ing Benjamin, the 2.7 release manager, in case he wants to comment on 
desirability of this bugfix in Python 2.7.

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-01 Thread pkerling


pkerling <9b6ab...@casix.org> added the comment:

Thanks! I'm a bit disappointed that it won't make it into 2.7, but I can 
understand the decision.

To give some context: I came across this while working on Kodi and noticing 
that it does not shutdown cleanly via Ctrl+C or SIGTERM. After investigating, I 
came to the conclusion that it is due to this bug. Kodi shuts down the Python 
interpreter every time no add-on is doing active work, which is almost 
guaranteed to happen shortly after application startup. Then this bug caused a 
reset of the SIGTERM handler to the default handler, making the Kodi handler 
that does a clean shutdown useless.
Now there are plans to switch to Python 3 in Kodi, but it won't happen until 
the major release after the next, so we're stuck with 2.7 for some time. I 
guess we'll have to work around this in Kodi for the time being.

--

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-01 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks pkerling for your bug report and your fix!

--

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-01 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-01 Thread Antoine Pitrou


Antoine Pitrou  added the comment:


New changeset 1d5198fd41ad9185e9e6b3aa595769c3693d57be by Antoine Pitrou (Miss 
Islington (bot)) in branch '3.6':
bpo-30654: Do not reset SIGINT handler to SIG_DFL in finisignal (GH-7146) 
(GH-7307)
https://github.com/python/cpython/commit/1d5198fd41ad9185e9e6b3aa595769c3693d57be


--

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-01 Thread Antoine Pitrou


Antoine Pitrou  added the comment:


New changeset 623b439abebc913bc416d92f38fe371e84b0276b by Antoine Pitrou (Miss 
Islington (bot)) in branch '3.7':
bpo-30654: Do not reset SIGINT handler to SIG_DFL in finisignal (GH-7146) 
(GH-7306)
https://github.com/python/cpython/commit/623b439abebc913bc416d92f38fe371e84b0276b


--

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-01 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

Ok, I think it go into 3.7.0 after all.  3.7.1 wouldn't get more testing before 
it's released anyway.

--

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-01 Thread Ned Deily


Ned Deily  added the comment:

> What's the procedure here?  If I backport the fix to the 3.7 branch, will it 
> go straight into the 3.7.0 release or will it be deferred to 3.7.1??

"All fixes that have been merged into the 3.7 branch as of cutoff tomorrow
will be in 3.7.0b5 and fixes merged afterwards will be in 3.7.0rc1 up to
its cutoff point. After 3.7.0rc1 cutoff, 3.7 merges will appear in 3.7.1.
Please continue to exercise diligence when deciding whether a change is
appropriate for 3.7; as a rule of thumb, treat the 3.7 branch as if it were
already released and in maintenance mode."

--

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-01 Thread STINNER Victor


STINNER Victor  added the comment:

> You have it backwards.  Please read the bug report.

I'm confused by the NEWS entry:

+Fixed reset of the SIGINT handler to SIG_DFL on interpreter shutdown even
+when there was a custom handler set previously. Patch by Philipp Kerling.

I read it as Python now always reset SIGINT to SIG_DFL. The commit title is 
more explicit: "Do not reset SIGINT (...)".

I propose to rephrase the NEWS entry as:

"""
Fix signal handlers when Python is embedded. On Python shutdown, do not reset 
the SIGINT handler to SIG_DFL, when a custom handler has been set before Python 
initialization. Patch by Philipp Kerling.
"""

--

Ok, now I understood the change. In this case, I'm ok to backport it to 3.6 and 
3.7.

Python 2.7 has this behavior since 10 years, it seems like people learnt to 
live with it. I also dislike touching Python 2.7, to prevent any risk of 
regression if someone really rely on the current behavior.

--

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-01 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

> For 3.7, we are very close to the final release. It doesn't give much time to 
> users to test the new behavior 

That's a fair point.  What's the procedure here?  If I backport the fix to the 
3.7 branch, will it go straight into the 3.7.0 release or will it be deferred 
to 3.7.1?  @Ned

--
nosy: +ned.deily

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-01 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

> So if an application has its own signal handler, Python replaces it...

You have it backwards.  Please read the bug report.

--

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-01 Thread STINNER Victor


STINNER Victor  added the comment:

> I'd rather not backport this to 2.7 as it's quite late in the maintenance 
> cycle and I'd like to avoid any regressions there.

Since it's a subtle behavior change and the PR doesn't add a flag to opt-in for 
the old behaviour, I'm not sure about backporting the change (to 3.6 or 3.7).

For 3.7, we are very close to the final release. It doesn't give much time to 
users to test the new behavior :-( I would suggest to keep the old behavior in 
Python 3.7 as well.

To be honest, I don't understand well the change. So I'm not confortable with 
it.

I understand that Py_Initialize() + Py_Finalize() restored the SIGINT handler, 
but now Python *always* sets SIGINT to SIG_DFL in Py_Finalize(). So if an 
application has its own signal handler, Python replaces it...

But embedded Python also gives the choice of not setting Python signal handlers 
in Py_Initialize().

--

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-01 Thread Antoine Pitrou


Antoine Pitrou  added the comment:

I'd rather not backport this to 2.7 as it's quite late in the maintenance cycle 
and I'd like to avoid any regressions there.

--

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-01 Thread Antoine Pitrou


Change by Antoine Pitrou :


--
versions: +Python 3.8 -Python 2.7, Python 3.5

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +6939

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-01 Thread miss-islington


Change by miss-islington :


--
pull_requests: +6938

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-06-01 Thread Antoine Pitrou


Antoine Pitrou  added the comment:


New changeset e905c84494526363086f66a979e317e155bf9536 by Antoine Pitrou 
(pkerling) in branch 'master':
bpo-30654: Do not reset SIGINT handler to SIG_DFL in finisignal (GH-7146)
https://github.com/python/cpython/commit/e905c84494526363086f66a979e317e155bf9536


--

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2018-05-28 Thread pkerling

Change by pkerling <9b6ab...@casix.org>:


--
keywords: +patch
pull_requests: +6780
stage:  -> patch review

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2017-06-13 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo, pitrou

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2017-06-13 Thread STINNER Victor

Changes by STINNER Victor :


--
versions:  -Python 3.3, Python 3.4

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2017-06-13 Thread Roundup Robot

Changes by Roundup Robot :


--
pull_requests: +2213

___
Python tracker 

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



[issue30654] signal module always overwrites SIGINT on interpreter shutdown

2017-06-13 Thread pkerling

New submission from pkerling:

The signal module checks the SIGINT handler on startup. It only registers a new 
custom handler if the default OS handler is still installed, so that when 
embedding python in an application the SIGINT handler of that application is 
not overwritten. 

But on shutdown in finisignal, it *always* sets SIGINT to SIG_DFL. The reason 
is that it saves the old handler in old_siginthandler, but *only* if the signal 
handler is overwritten in init, which only happens when it was SIG_DFL in the 
first place! If there was already a handler in place in init (-> no 
overwriting), old_siginthandler will default to the initialization value, which 
is also SIG_DFL.

This means that when an application embeds Python and needs a custom SIGINT 
handler, it will stop to work as soon as it shuts down Python since it will 
always be reset to SIG_DFL.

--
components: Interpreter Core
messages: 295915
nosy: pkerling
priority: normal
severity: normal
status: open
title: signal module always overwrites SIGINT on interpreter shutdown
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

___
Python tracker 

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