This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: _PyOS_SigintEvent is never closed on Windows
Type: enhancement Stage: resolved
Components: Windows Versions: Python 3.10, Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: tim.golden Nosy List: corona10, eric.snow, paul.moore, steve.dower, tim.golden, vstinner, zach.ware
Priority: normal Keywords:

Created on 2020-06-08 18:39 by steve.dower, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (4)
msg371036 - (view) Author: Steve Dower (steve.dower) * (Python committer) Date: 2020-06-08 18:39
Currently, it's just stored as global state in signalmodule.c and forgotten about. It probably needs to become module state, and the signal module needs better initialization/shutdown.
msg371041 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-08 19:44
PyOS_FiniInterrupts() is a good place to close _PyOS_SigintEvent. Hopefully, it's a internal C API and it's not exported, since it's fine to change its behavior. Maybe it should be renamed to _PyOS_FiniInterrupts().
msg399189 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2021-08-07 14:58
@vstinner
https://github.com/python/cpython/blob/ae0a2b756255629140efcbe57fc2e714f0267aa3/Modules/signalmodule.c#L1743

Since _PySignal_Fini close the handle, IMHO we can close this issue.
Is there any corner case to handle this?
msg399263 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2021-08-09 13:14
Fixed by bpo-41686:

commit 0ae323b87f1bed64a7fa70f5a41a5800aca032cc
Author: Victor Stinner <vstinner@python.org>
Date:   Tue Nov 17 18:15:20 2020 +0100

    bpo-41686: Always create the SIGINT event on Windows (GH-23344)
    
    bpo-41686, bpo-41713: On Windows, the SIGINT event,
    _PyOS_SigintEvent(), is now created even if Python is configured to
    not install signal handlers (PyConfig.install_signal_handlers=0 or
    Py_InitializeEx(0)).
    
    Changes:
    
    * Move global variables initialization from signal_exec() to
      _PySignal_Init() to clarify that they are global variables cleared
      by _PySignal_Fini().
    * _PySignal_Fini() now closes sigint_event.
    * IntHandler is no longer a global variable.
History
Date User Action Args
2022-04-11 14:59:32adminsetgithub: 85089
2021-08-09 13:14:27vstinnersetstatus: open -> closed
resolution: fixed
messages: + msg399263

stage: needs patch -> resolved
2021-08-07 14:58:34corona10setmessages: + msg399189
2020-08-25 09:52:06corona10setnosy: + corona10
2020-06-12 05:42:10tim.goldensetassignee: tim.golden
2020-06-08 19:44:50vstinnersetmessages: + msg371041
2020-06-08 18:39:53steve.dowercreate