mvantellingen/psycopg2-ctypes — pull request #18 by smira (2011-12-28 07:37:24+00:00)
Title: Report connection as closed if internal flag is set or libpq knows that connection is closed.

This fixes problem when connection is closed on backend side and
conn.closed() still reports False, while conn.fileno() would return -1,
indicating that connection is broken.

It is strange though, that even the implementation of closed() is the same in psycopg2 and psycopg2-ctypes, psycopg2 doesn't expose this problem.