[New-bugs-announce] [issue47019] Fatal Python Error in sqlite3 Python 3.10

hydroflask 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)
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 <report at bugs.python.org>
<https://bugs.python.org/issue47019>
_______________________________________


More information about the New-bugs-announce mailing list