Skip to content
Closed
Prev Previous commit
Next Next commit
Clean up refleaks in _warnings initialization.
  • Loading branch information
brandtbucher committed Jan 28, 2020
commit 418d79bdcdcb3e59adcb5737f7bbf859b59c0bcb
6 changes: 3 additions & 3 deletions Python/_warnings.c
Original file line number Diff line number Diff line change
Expand Up @@ -1353,17 +1353,17 @@ _PyWarnings_Init(void)
}

Py_INCREF(st->filters);
if (PyModule_AddObject(m, "filters", st->filters) < 0) {
if (_PyModule_StealObject(m, "filters", st->filters) < 0) {
goto error;
}

Py_INCREF(st->once_registry);
if (PyModule_AddObject(m, "_onceregistry", st->once_registry) < 0) {
if (_PyModule_StealObject(m, "_onceregistry", st->once_registry) < 0) {
goto error;
}

Py_INCREF(st->default_action);
if (PyModule_AddObject(m, "_defaultaction", st->default_action) < 0) {
if (_PyModule_StealObject(m, "_defaultaction", st->default_action) < 0) {
goto error;
}

Expand Down