[New-bugs-announce] [issue45089] [sqlite3] the trace callback does not raise exceptions on error

Erlend E. Aasland report at bugs.python.org
Thu Sep 2 16:42:26 EDT 2021

New submission from Erlend E. Aasland <erlend.aasland at innova.no>:

Currently, two calls can raise exceptions in the _trace_callback() in Modules/_sqlite/connection.c:

  1. PyUnicode_DecodeUTF8() can raise an exception
  2. PyObject_CallOneArg() — calling the user callback — can raise an exception

Currently, we either PyErr_Print() the traceback, or we PyErr_Clear() it. In either case; we clear the current exception. The other SQLite callbacks pass some kind of return value back to SQLite to indicate failure (which is normally then passed to _pysqlite_seterror() via sqlite3_step() or sqlite3_finalize(), but the trace callback does not pass errors back to SQLite; we're unable to detect if the trace callback fails.

components: Extension Modules
files: reproducer.py
messages: 400955
nosy: erlendaasland
priority: normal
severity: normal
status: open
title: [sqlite3] the trace callback does not raise exceptions on error
versions: Python 3.11
Added file: https://bugs.python.org/file50259/reproducer.py

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list