From 58e98ba4eac38eab756097e956fd9364ef8276b5 Mon Sep 17 00:00:00 2001 From: Eoin Shaughnessy Date: Fri, 17 Apr 2026 02:11:12 +0100 Subject: [PATCH 1/2] gh-148663: Document that IllegalMonthError inherits from both ValueError and IndexError --- Doc/library/calendar.rst | 5 ++++- .../2026-04-17-02-28-55.gh-issue-148663.MHIbRB.rst | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 Misc/NEWS.d/next/Documentation/2026-04-17-02-28-55.gh-issue-148663.MHIbRB.rst diff --git a/Doc/library/calendar.rst b/Doc/library/calendar.rst index 54cafaf4fe47d8..a412f7652a336b 100644 --- a/Doc/library/calendar.rst +++ b/Doc/library/calendar.rst @@ -580,8 +580,11 @@ The :mod:`!calendar` module defines the following exceptions: .. exception:: IllegalMonthError(month) - A subclass of :exc:`ValueError`, + A subclass of both :exc:`ValueError` and :exc:`IndexError`, raised when the given month number is outside of the range 1-12 (inclusive). + The :exc:`IndexError` base class is preserved for backwards compatibility + with code that caught :exc:`IndexError` for bad month numbers prior to + Python 3.13. .. attribute:: month diff --git a/Misc/NEWS.d/next/Documentation/2026-04-17-02-28-55.gh-issue-148663.MHIbRB.rst b/Misc/NEWS.d/next/Documentation/2026-04-17-02-28-55.gh-issue-148663.MHIbRB.rst new file mode 100644 index 00000000000000..fa95447fb4ae20 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2026-04-17-02-28-55.gh-issue-148663.MHIbRB.rst @@ -0,0 +1,5 @@ +Document that :class:`calendar.IllegalMonthError` inherits from both +:exc:`ValueError` and :exc:`IndexError`, preserving :exc:`IndexError` for +backwards compatibility with code that caught it for bad month numbers prior +to Python 3.13. +########################################################################### From 73da73188a363bbb91b2c4652812669382f27c12 Mon Sep 17 00:00:00 2001 From: Eoin Shaughnessy Date: Sat, 18 Apr 2026 12:35:06 +0100 Subject: [PATCH 2/2] gh-100557: Clarify signal.pause() docs to explain it only wakes on handled signals --- .../2026-04-18-12-38-41.gh-issue-100557.a6MWvZ.rst | 4 ++++ Modules/clinic/signalmodule.c.h | 6 +++++- Modules/signalmodule.c | 6 +++++- 3 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Documentation/2026-04-18-12-38-41.gh-issue-100557.a6MWvZ.rst diff --git a/Misc/NEWS.d/next/Documentation/2026-04-18-12-38-41.gh-issue-100557.a6MWvZ.rst b/Misc/NEWS.d/next/Documentation/2026-04-18-12-38-41.gh-issue-100557.a6MWvZ.rst new file mode 100644 index 00000000000000..eac31c915f2fc8 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2026-04-18-12-38-41.gh-issue-100557.a6MWvZ.rst @@ -0,0 +1,4 @@ +Clarify the documentation for :func:`signal.pause` to explain that it only +returns when a signal with an installed handler is delivered, not when an +ignored signal arrives. +########################################################################### diff --git a/Modules/clinic/signalmodule.c.h b/Modules/clinic/signalmodule.c.h index 9fd24d15bf2500..b3c09ea8e1e133 100644 --- a/Modules/clinic/signalmodule.c.h +++ b/Modules/clinic/signalmodule.c.h @@ -87,7 +87,11 @@ PyDoc_STRVAR(signal_pause__doc__, "pause($module, /)\n" "--\n" "\n" -"Wait until a signal arrives."); +"Wait until a signal with an installed handler is delivered.\n" +"\n" +"Cause the process to sleep until a signal is received that either\n" +"terminates it or causes it to call a signal-catching function. If the\n" +"signal is being ignored, pause() is not interrupted."); #define SIGNAL_PAUSE_METHODDEF \ {"pause", (PyCFunction)signal_pause, METH_NOARGS, signal_pause__doc__}, diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c index fb548b8ca00f24..4de218d8f69eea 100644 --- a/Modules/signalmodule.c +++ b/Modules/signalmodule.c @@ -395,7 +395,11 @@ signal_alarm_impl(PyObject *module, int seconds) /*[clinic input] signal.pause -Wait until a signal arrives. +Wait until a signal with an installed handler is delivered. + +Cause the process to sleep until a signal is received that either +terminates it or causes it to call a signal-catching function. If the +signal is being ignored, pause() is not interrupted. [clinic start generated code]*/ static PyObject *