gh-104341: Adjust tstate_must_exit() to Respect Interpreter Finalization (gh-104437)

With the move to a per-interpreter GIL, this check slipped through the cracks.
This commit is contained in:
Eric Snow 2023-05-15 13:59:26 -06:00 committed by GitHub
parent cb88ae635e
commit 26baa747c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 56 additions and 10 deletions

View file

@ -419,7 +419,7 @@ connection_close(pysqlite_Connection *self)
{
/* If close is implicitly called as a result of interpreter
* tear-down, we must not call back into Python. */
if (_Py_IsFinalizing()) {
if (_Py_IsInterpreterFinalizing(PyInterpreterState_Get())) {
remove_callbacks(self->db);
}
(void)connection_exec_stmt(self, "ROLLBACK");