Python 3.1 fails to build when db.h contains non-UTF-8 characters. Python 3.1 checks for db.h even though Python 3 doesn't contain bsddb module. See also https://bugs.gentoo.org/show_bug.cgi?id=280001 Please at least apply the attached patch, or completely remove check for db.h.