diff -r 8ec5a00e5d75 Modules/_sqlite/util.c --- a/Modules/_sqlite/util.c Sat Aug 27 21:26:35 2016 +0300 +++ b/Modules/_sqlite/util.c Mon Aug 29 23:13:39 2016 +0300 @@ -54,9 +54,13 @@ (void)sqlite3_reset(st); } +#ifdef HAVE_SQLITE3_EXTENDED_RESULT_CODES + errorcode = sqlite3_extended_errcode(db); +#else errorcode = sqlite3_errcode(db); +#endif - switch (errorcode) + switch (errorcode & 0xff) { case SQLITE_OK: PyErr_Clear(); diff -r 8ec5a00e5d75 configure.ac --- a/configure.ac Sat Aug 27 21:26:35 2016 +0300 +++ b/configure.ac Mon Aug 29 23:13:39 2016 +0300 @@ -2729,6 +2729,10 @@ AC_MSG_RESULT($enable_loadable_sqlite_extensions) +# Check for support for sqlite3 extended result codes +AC_CHECK_LIB(sqlite3, sqlite3_extended_result_codes, + AC_DEFINE(HAVE_SQLITE3_EXTENDED_RESULT_CODES, 1, [Define if the sqlite3 library has sqlite3_extended_result_codes])) + # Check for --with-tcltk-includes=path and --with-tcltk-libs=path AC_SUBST(TCLTK_INCLUDES) AC_SUBST(TCLTK_LIBS) diff -r 8ec5a00e5d75 pyconfig.h.in --- a/pyconfig.h.in Sat Aug 27 21:26:35 2016 +0300 +++ b/pyconfig.h.in Mon Aug 29 23:13:39 2016 +0300 @@ -904,6 +904,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SPAWN_H +/* Define if the sqlite3 library has sqlite3_extended_result_codes */ +#undef HAVE_SQLITE3_EXTENDED_RESULT_CODES + /* Define if your compiler provides ssize_t */ #undef HAVE_SSIZE_T