New submission from hydroflask <hydrofl...@yqxmail.com>:

_destructor in connection.c in Python 3.10+ now calls `PyGILState_Ensure()`, 
this is a problem because if the destructor is being called while the thread is 
being torn down it will cause an unbalanced/erroneous call to 
"PyEval_RestoreThread" in PyGILState_Ensure which will eventually trigger a 
Fatal Python Error. A perfect repro has been attached, should be run on Linux.

My recommended fix is to call sqlite3_close() within 
Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS, and manually Py_DECREF all 
connection-related functions afterward.

----------
components: Extension Modules, Library (Lib)
files: sqlite3_fatal_python_error.py
messages: 415212
nosy: erlendaasland, hydroflask
priority: normal
severity: normal
status: open
title: Fatal Python Error in sqlite3 Python 3.10
type: crash
versions: Python 3.10, Python 3.11
Added file: https://bugs.python.org/file50676/sqlite3_fatal_python_error.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue47019>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to