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 @@ -851,7 +851,12 @@ static void _pysqlite_drop_unused_cursor_references(pysqlite_Connection* self)
851
851
852
852
static void _destructor (void * args )
853
853
{
854
+ // This function may be called without the GIL held, so we need to ensure
855
+ // that we destroy 'args' with the GIL
856
+ PyGILState_STATE gstate ;
857
+ gstate = PyGILState_Ensure ();
854
858
Py_DECREF ((PyObject * )args );
859
+ PyGILState_Release (gstate );
855
860
}
856
861
857
862
/*[clinic input]
Original file line number Diff line number Diff line change @@ -398,7 +398,9 @@ stmt_dealloc(pysqlite_Statement *self)
398
398
PyObject_ClearWeakRefs ((PyObject * )self );
399
399
}
400
400
if (self -> st ) {
401
+ Py_BEGIN_ALLOW_THREADS
401
402
sqlite3_finalize (self -> st );
403
+ Py_END_ALLOW_THREADS
402
404
self -> st = 0 ;
403
405
}
404
406
tp -> tp_clear ((PyObject * )self );
You can’t perform that action at this time.
0 commit comments