[New-bugs-announce] [issue16783] sqlite3 accepts strings it cannot return

William D. Colburn report at bugs.python.org
Wed Dec 26 07:59:16 CET 2012

New submission from William D. Colburn:

This seems to be just like issue6010, which is closed as "not as bug" which is simple irresponsible on the part of Python.

The problem is that I can store data into sqlite3 which cannot be retrieved.  The data I encountered was a string with a \xa0 in it that was read from urllib2.  I deposited that data into an sqlite3 database with no trouble at all.  Later, however, sqlite3 would throw an exception when I tried to retrieve the data.

Martin v. Löwis says this is user error because sqlite3 assumes UTF-8. It makes no sense that storeable data cannot be retrieved and that the failure of sqlite3 is a user-error.  If sqlite3 assumes UTF-8, then the error should have been caught when I did the store because I was not storing UTF-8 data.  Accepting bad input and blaming the user later down the line is bad bug handling, especially because the two events might be separated by a tremendous gap of time and code which makes debugging quite hard.  I was only able to find the errant character by popping the streamed webpage into emacs as both python and firefox showed me a normal looking string with nothing wrong with it.

components: Unicode
messages: 178189
nosy: William.D..Colburn, ezio.melotti
priority: normal
severity: normal
status: open
title: sqlite3 accepts strings it cannot return
type: behavior
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list