-
-
Notifications
You must be signed in to change notification settings - Fork 33.6k
Open
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-asynciotype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
I'm currently writing this to support signals on Windows and Linux:
loop = asyncio.get_running_loop()
def shutdown(*args):
// some shutdown sequence
if sys.platform == "win32":
for sig in (signal.SIGINT, signal.SIGTERM):
signal.signal(sig, shutdown)
else:
for sig in (signal.SIGINT, signal.SIGTERM):
loop.add_signal_handler(sig, shutdown)Works great, but why would signal.signal be supported on Linux and Windows, but asyncio's AbstractEventLoop via add_signal_handler only on Linux? Can't this be platform agnostic?
add_signal_handler would raise the following on Windows:
[...]\Python\Python313\Lib\asyncio\events.py", line 596, in add_signal_handler
raise NotImplementedError
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
sanmai-NL
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-asynciotype-featureA feature request or enhancementA feature request or enhancement
Projects
Status
Todo