mirror of
https://github.com/python/cpython.git
synced 2025-08-27 12:16:04 +00:00
bpo-42021: Fix possible ref leaks during _sqlite3 module init (GH-22673)
This commit is contained in:
parent
b67cbbda3a
commit
644e94272a
4 changed files with 94 additions and 130 deletions
|
@ -37,14 +37,19 @@ static PyObject *psyco_adapters = NULL;
|
|||
/* pysqlite_microprotocols_init - initialize the adapters dictionary */
|
||||
|
||||
int
|
||||
pysqlite_microprotocols_init(PyObject *dict)
|
||||
pysqlite_microprotocols_init(PyObject *module)
|
||||
{
|
||||
/* create adapters dictionary and put it in module namespace */
|
||||
if ((psyco_adapters = PyDict_New()) == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return PyDict_SetItemString(dict, "adapters", psyco_adapters);
|
||||
if (PyModule_AddObject(module, "adapters", psyco_adapters) < 0) {
|
||||
Py_DECREF(psyco_adapters);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue