bpo-38823: Clean up refleaks in _asyncio initialization. (GH-17195)

https://bugs.python.org/issue38823
This commit is contained in:
Brandt Bucher 2019-11-16 14:26:54 -08:00 committed by Miss Islington (bot)
parent d0acdfcf34
commit c3f6bdc332
1 changed files with 4 additions and 0 deletions

View File

@ -3387,24 +3387,28 @@ PyInit__asyncio(void)
Py_INCREF(&FutureType); Py_INCREF(&FutureType);
if (PyModule_AddObject(m, "Future", (PyObject *)&FutureType) < 0) { if (PyModule_AddObject(m, "Future", (PyObject *)&FutureType) < 0) {
Py_DECREF(&FutureType); Py_DECREF(&FutureType);
Py_DECREF(m);
return NULL; return NULL;
} }
Py_INCREF(&TaskType); Py_INCREF(&TaskType);
if (PyModule_AddObject(m, "Task", (PyObject *)&TaskType) < 0) { if (PyModule_AddObject(m, "Task", (PyObject *)&TaskType) < 0) {
Py_DECREF(&TaskType); Py_DECREF(&TaskType);
Py_DECREF(m);
return NULL; return NULL;
} }
Py_INCREF(all_tasks); Py_INCREF(all_tasks);
if (PyModule_AddObject(m, "_all_tasks", all_tasks) < 0) { if (PyModule_AddObject(m, "_all_tasks", all_tasks) < 0) {
Py_DECREF(all_tasks); Py_DECREF(all_tasks);
Py_DECREF(m);
return NULL; return NULL;
} }
Py_INCREF(current_tasks); Py_INCREF(current_tasks);
if (PyModule_AddObject(m, "_current_tasks", current_tasks) < 0) { if (PyModule_AddObject(m, "_current_tasks", current_tasks) < 0) {
Py_DECREF(current_tasks); Py_DECREF(current_tasks);
Py_DECREF(m);
return NULL; return NULL;
} }