Index: Lib/sqlite3/test/types.py =================================================================== --- Lib/sqlite3/test/types.py (revision 58574) +++ Lib/sqlite3/test/types.py (working copy) @@ -76,6 +76,10 @@ class DeclTypesTests(unittest.TestCase): class Foo: def __init__(self, _val): + if isinstance(_val, str8): + # sqlite3 always calls __init__ with a str8 created from a + # UTF-8 string when __conform__ was used to store the object. + _val = _val.decode('utf8') self.val = _val def __cmp__(self, other): Index: Modules/_sqlite/cursor.c =================================================================== --- Modules/_sqlite/cursor.c (revision 58574) +++ Modules/_sqlite/cursor.c (working copy) @@ -182,7 +182,7 @@ if (*pos == '[') { type_start = pos + 1; } else if (*pos == ']' && type_start != (const char*)-1) { - key = PyString_FromStringAndSize(type_start, pos - type_start); + key = PyUnicode_FromStringAndSize(type_start, pos - type_start); if (!key) { /* creating a string failed, but it is too complicated * to propagate the error here, we just assume there is @@ -203,7 +203,7 @@ if (decltype) { for (pos = decltype;;pos++) { if (*pos == ' ' || *pos == 0) { - py_decltype = PyString_FromStringAndSize(decltype, pos - decltype); + py_decltype = PyUnicode_FromStringAndSize(decltype, pos - decltype); if (!py_decltype) { return -1; }