diff options
author | Kirill Podoprigora <kirill.bast9@mail.ru> | 2024-06-30 17:48:00 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-30 17:48:00 (GMT) |
commit | 1a84bdc2371ada60c01c72493caba62c9860007b (patch) | |
tree | 8d3311d199c03027caf92bb505bf58cd1ef80cfb /Python | |
parent | 2a455bbe8fd91a688ae20509a2fdc8beaa8c8447 (diff) | |
download | cpython-1a84bdc2371ada60c01c72493caba62c9860007b.zip cpython-1a84bdc2371ada60c01c72493caba62c9860007b.tar.gz cpython-1a84bdc2371ada60c01c72493caba62c9860007b.tar.bz2 |
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()``.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/_warnings.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c index 17404d3..3f9e73b 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) { |