Remove cyclic reference between Connection and Cursor

Using Connection.errorhandler inside of Cursor directly, and creating
Connection._last_execute_cursor from within Cursor was creating a cyclic
reference between Cursor and Connection (which uses a finalizer)
ultimately leaking both a Connection and a Cursor.
Add a test for the cyclic reference leak issue, and fix tests so that they run on Python 3.2