Title: Signal handling machinery still relies on "pending calls".
Type: behavior Stage: resolved
Components: Interpreter Core Versions: Python 3.8
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: eric.snow Nosy List: emilyemorehouse, eric.snow, pitrou, vstinner
Priority: normal Keywords: patch

Created on 2018-12-06 00:12 by eric.snow, last changed 2019-01-11 21:50 by eric.snow. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 10972 merged eric.snow, 2018-12-06 00:18
Messages (4)
msg331196 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2018-12-06 00:12
For a while now the signal handling machinery has piggy-backed on ceval's "pending calls" machinery (e.g. Py_AddPendingCall).  This is a bit confusing.  It also increases the risk with unrelated changes to the pending calls code.
msg331197 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2018-12-06 00:16
In the master branch, the signal handler only uses pending calls to report error on writing into the "wakeup_fd" (fd or socket handle):

commit c08177a1ccad2ed0d50898c2731b518c631aed14
Author: Antoine Pitrou <>
Date:   Wed Jun 28 23:29:29 2017 +0200

    bpo-30703: Improve signal delivery (#2415)
msg331654 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2018-12-11 21:55
Correct.  The remaining call to Py_AddPendingCall in the signal-handling code is fine.

This issue is only indirectly related.  I suppose you could consider it a follow-up to #30703.  The PR for that issue (GH-2415) switches from using pending calls for signal handlers to using the pending calls machinery without actual pending calls.

So here I want to address taking the next step: deal with pending signals separately from pending calls.  That separation helps simplify efforts to adapt the pending calls machinery for use in arbitrary threads (rather than the main thread).  See #33608.
msg333507 - (view) Author: Eric Snow (eric.snow) * (Python committer) Date: 2019-01-11 21:27
New changeset fdf282d609fd172d52b59a6f1f062eb701494528 by Eric Snow in branch 'master':
bpo-35423: Stop using the "pending calls" machinery for signals. (gh-10972)
Date User Action Args
2019-01-11 21:50:36eric.snowsetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2019-01-11 21:27:07eric.snowsetmessages: + msg333507
2018-12-11 23:02:53eric.snowsetnosy: + emilyemorehouse
2018-12-11 21:55:32eric.snowsetnosy: + pitrou
messages: + msg331654
components: + Interpreter Core
2018-12-06 00:18:14eric.snowsetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request10214
2018-12-06 00:16:05vstinnersetnosy: + vstinner
messages: + msg331197
2018-12-06 00:12:39eric.snowcreate