File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -825,7 +825,12 @@ static void _pysqlite_drop_unused_cursor_references(pysqlite_Connection* self)
825
825
826
826
static void _destructor (void * args )
827
827
{
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 ();
828
832
Py_DECREF ((PyObject * )args );
833
+ PyGILState_Release (gstate );
829
834
}
830
835
831
836
/*[clinic input]
Original file line number Diff line number Diff line change @@ -404,7 +404,9 @@ stmt_dealloc(pysqlite_Statement *self)
404
404
PyObject_ClearWeakRefs ((PyObject * )self );
405
405
}
406
406
if (self -> st ) {
407
+ Py_BEGIN_ALLOW_THREADS
407
408
sqlite3_finalize (self -> st );
409
+ Py_END_ALLOW_THREADS
408
410
self -> st = 0 ;
409
411
}
410
412
tp -> tp_clear ((PyObject * )self );
You can’t perform that action at this time.
0 commit comments