mirror of
https://github.com/python/cpython.git
synced 2025-08-23 02:04:56 +00:00
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()``.
This commit is contained in:
parent
2a455bbe8f
commit
1a84bdc237
5 changed files with 49 additions and 43 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue