Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 77e543c

Browse files
committed
Issue #21382: Clarify signal.signal() documentation on Windows
All signal.SIG* constants may not be defined on Windows so a call like signal.signal(signal.SIGPIPE, lambda signum, frame: sys.exit(1)) will raise an AttributeError.
1 parent 0269828 commit 77e543c

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Doc/library/signal.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,9 @@ The :mod:`signal` module defines the following functions:
351351
On Windows, :func:`signal` can only be called with :const:`SIGABRT`,
352352
:const:`SIGFPE`, :const:`SIGILL`, :const:`SIGINT`, :const:`SIGSEGV`, or
353353
:const:`SIGTERM`. A :exc:`ValueError` will be raised in any other case.
354+
Note that not all systems define the same set of signal names; an
355+
:exc:`AttributeError` will be raised if a signal name is not defined as
356+
``SIG*`` module level constant.
354357

355358

356359
.. function:: sigpending()

0 commit comments

Comments
 (0)