From 1a84bdc2371ada60c01c72493caba62c9860007b Mon Sep 17 00:00:00 2001 From: Kirill Podoprigora Date: Sun, 30 Jun 2024 20:48:00 +0300 Subject: gh-121163: Add "all" as an valid alias for "always" in warnings.simplefilter() (#121164) Add support for ``all`` as an valid alias for ``always`` in ``warnings.simplefilter()`` and ``warnings.filterswarnings()``. --- Python/_warnings.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Python/_warnings.c') diff --git a/Python/_warnings.c b/Python/_warnings.c index 17404d33c1c..3f9e73b5376 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -704,9 +704,9 @@ warn_explicit(PyThreadState *tstate, PyObject *category, PyObject *message, } /* Store in the registry that we've been here, *except* when the action - is "always". */ + is "always" or "all". */ rc = 0; - if (!_PyUnicode_EqualToASCIIString(action, "always")) { + if (!_PyUnicode_EqualToASCIIString(action, "always") && !_PyUnicode_EqualToASCIIString(action, "all")) { if (registry != NULL && registry != Py_None && PyDict_SetItem(registry, key, Py_True) < 0) { -- cgit v1.2.3