Is this conversion problem going to occur anywhere else though? It seems that if pyPgSQL is returning something that is almost-an-int here, it may do so elsewhere.
chrisky, is it possible to try one of the other PostgreSQL DBAPI layers, specifically psycopg2, (then remove the patch)? I'd be interested to see if the problem still occurs.