mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
bpo-32089: Use default action for ResourceWarning (#4584)
In development and debug mode, use the "default" action, rather than the "always" action, for ResourceWarning in the default warnings filters.
This commit is contained in:
parent
c172fc5031
commit
21c7730761
4 changed files with 10 additions and 21 deletions
|
@ -13,7 +13,6 @@ _Py_IDENTIFIER(argv);
|
|||
_Py_IDENTIFIER(stderr);
|
||||
_Py_IDENTIFIER(ignore);
|
||||
_Py_IDENTIFIER(error);
|
||||
_Py_IDENTIFIER(always);
|
||||
_Py_static_string(PyId_default, "default");
|
||||
|
||||
static int
|
||||
|
@ -1208,9 +1207,9 @@ init_filters(const _PyCoreConfig *config)
|
|||
_Py_Identifier *resource_action;
|
||||
/* resource usage warnings are enabled by default in pydebug mode */
|
||||
#ifdef Py_DEBUG
|
||||
resource_action = &PyId_always;
|
||||
resource_action = &PyId_default;
|
||||
#else
|
||||
resource_action = (dev_mode ? &PyId_always : &PyId_ignore);
|
||||
resource_action = (dev_mode ? &PyId_default: &PyId_ignore);
|
||||
#endif
|
||||
PyList_SET_ITEM(filters, pos++, create_filter(PyExc_ResourceWarning,
|
||||
resource_action));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue