mirror of
https://github.com/python/cpython
synced 2024-09-16 00:27:20 +00:00
be extra careful with a borrowed reference when the GIL could be released (closes #8578)
This commit is contained in:
parent
2e3a38a774
commit
5c2b09e856
|
@ -200,11 +200,13 @@ void pysqlite_do_all_statements(pysqlite_Connection* self, int action, int reset
|
|||
weakref = PyList_GetItem(self->statements, i);
|
||||
statement = PyWeakref_GetObject(weakref);
|
||||
if (statement != Py_None) {
|
||||
Py_INCREF(statement);
|
||||
if (action == ACTION_RESET) {
|
||||
(void)pysqlite_statement_reset((pysqlite_Statement*)statement);
|
||||
} else {
|
||||
(void)pysqlite_statement_finalize((pysqlite_Statement*)statement);
|
||||
}
|
||||
Py_DECREF(statement);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue