diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2012-01-18 20:45:15 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2012-01-18 20:45:15 (GMT) |
commit | aa5c5c60f1e077b6d68804adeb8b05638abb3dd7 (patch) | |
tree | 8511194a0d1c05513261a5c53392e9a846198564 /Python/_warnings.c | |
parent | ac456a183926d187c52e7dd80b9212881dd88af5 (diff) | |
download | cpython-aa5c5c60f1e077b6d68804adeb8b05638abb3dd7.zip cpython-aa5c5c60f1e077b6d68804adeb8b05638abb3dd7.tar.gz cpython-aa5c5c60f1e077b6d68804adeb8b05638abb3dd7.tar.bz2 |
Finally fix all test_capi refleaks
Diffstat (limited to 'Python/_warnings.c')
-rw-r--r-- | Python/_warnings.c | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/Python/_warnings.c b/Python/_warnings.c index adebd51..f33e477 100644 --- a/Python/_warnings.c +++ b/Python/_warnings.c @@ -958,23 +958,30 @@ _PyWarnings_Init(void) if (m == NULL) return NULL; - _filters = init_filters(); - if (_filters == NULL) - return NULL; + if (_filters == NULL) { + _filters = init_filters(); + if (_filters == NULL) + return NULL; + } Py_INCREF(_filters); if (PyModule_AddObject(m, "filters", _filters) < 0) return NULL; - _once_registry = PyDict_New(); - if (_once_registry == NULL) - return NULL; + if (_once_registry == NULL) { + _once_registry = PyDict_New(); + if (_once_registry == NULL) + return NULL; + } Py_INCREF(_once_registry); if (PyModule_AddObject(m, "_onceregistry", _once_registry) < 0) return NULL; - _default_action = PyUnicode_FromString("default"); - if (_default_action == NULL) - return NULL; + if (_default_action == NULL) { + _default_action = PyUnicode_FromString("default"); + if (_default_action == NULL) + return NULL; + } + Py_INCREF(_default_action); if (PyModule_AddObject(m, "_defaultaction", _default_action) < 0) return NULL; return m; |