File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -825,7 +825,12 @@ static void _pysqlite_drop_unused_cursor_references(pysqlite_Connection* self)
825825
826826static void _destructor (void * args )
827827{
828+ // This function may be called without the GIL held, so we need to ensure
829+ // that we destroy 'args' with the GIL
830+ PyGILState_STATE gstate ;
831+ gstate = PyGILState_Ensure ();
828832 Py_DECREF ((PyObject * )args );
833+ PyGILState_Release (gstate );
829834}
830835
831836/*[clinic input]
Original file line number Diff line number Diff line change @@ -404,7 +404,9 @@ stmt_dealloc(pysqlite_Statement *self)
404404 PyObject_ClearWeakRefs ((PyObject * )self );
405405 }
406406 if (self -> st ) {
407+ Py_BEGIN_ALLOW_THREADS
407408 sqlite3_finalize (self -> st );
409+ Py_END_ALLOW_THREADS
408410 self -> st = 0 ;
409411 }
410412 tp -> tp_clear ((PyObject * )self );
You can’t perform that action at this time.
0 commit comments