From fb6726feeee841a480a1b08f4d02a8a73fd8229d Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 15:09:04 +0100 Subject: [PATCH] [PR #7043/bee613d0 backport][3.10] Add clarification about `GracefulExit` when using `handle_signals=True` (#9122) **This is a backport of PR #7043 as merged into master (bee613d090cab3b7c00a83604668181961b562ff).** Co-authored-by: Daste --- CHANGES/4414.doc | 1 + docs/web_reference.rst | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 CHANGES/4414.doc diff --git a/CHANGES/4414.doc b/CHANGES/4414.doc new file mode 100644 index 00000000000..b4be46afee8 --- /dev/null +++ b/CHANGES/4414.doc @@ -0,0 +1 @@ +Clarified that ``GracefulExit`` needs to be handled in ``AppRunner`` and ``ServerRunner`` when using ``handle_signals=True``. -- by :user:`Daste745` diff --git a/docs/web_reference.rst b/docs/web_reference.rst index bb22cfd6369..cdfe5a050e9 100644 --- a/docs/web_reference.rst +++ b/docs/web_reference.rst @@ -2734,7 +2734,8 @@ application on specific TCP or Unix socket, e.g.:: :param bool handle_signals: add signal handlers for :data:`signal.SIGINT` and :data:`signal.SIGTERM` (``False`` by - default). + default). These handlers will raise + :exc:`GracefulExit`. :param kwargs: named parameters to pass into web protocol. @@ -2807,7 +2808,8 @@ application on specific TCP or Unix socket, e.g.:: :param bool handle_signals: add signal handlers for :data:`signal.SIGINT` and :data:`signal.SIGTERM` (``False`` by - default). + default). These handlers will raise + :exc:`GracefulExit`. :param kwargs: named parameters to pass into web protocol. @@ -2938,6 +2940,16 @@ application on specific TCP or Unix socket, e.g.:: ``128`` by default. +.. exception:: GracefulExit + + Raised by signal handlers for :data:`signal.SIGINT` and :data:`signal.SIGTERM` + defined in :class:`AppRunner` and :class:`ServerRunner` + when ``handle_signals`` is set to ``True``. + + Inherited from :exc:`SystemExit`, + which exits with error code ``1`` if not handled. + + Utilities ---------