[New-bugs-announce] [issue47019] Fatal Python Error in sqlite3 Python 3.10
report at bugs.python.org
Mon Mar 14 20:18:22 EDT 2022
New submission from hydroflask <hydroflask at 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)
nosy: erlendaasland, hydroflask
title: Fatal Python Error in sqlite3 Python 3.10
versions: Python 3.10, Python 3.11
Added file: https://bugs.python.org/file50676/sqlite3_fatal_python_error.py
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce