[New-bugs-announce] [issue28729] Exception from sqlite3 adapter masked by sqlite3.InterfaceError

Peter Inglesby report at bugs.python.org
Thu Nov 17 18:25:40 EST 2016


New submission from Peter Inglesby:

The following code raises `sqlite3.InterfaceError: Error binding parameter 0 - probably unsupported type.` when I would expect it to raise `AssertionError: Problem in adapter`.


import sqlite3

class Point:
    def __init__(self, x, y):
        self.x, self.y = x, y

def adapt_point(point):
    assert False, 'Problem in adapter'

sqlite3.register_adapter(Point, adapt_point)

con = sqlite3.connect(":memory:")
cur = con.cursor()

p = Point(4.0, -3.2)
cur.execute("select ?", (p,))

----------
messages: 281066
nosy: inglesp
priority: normal
severity: normal
status: open
title: Exception from sqlite3 adapter masked by sqlite3.InterfaceError
type: behavior
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28729>
_______________________________________


More information about the New-bugs-announce mailing list