[Resending after properly subscribing.]

Hello,

With the following reproduction script, which uses the classic API and
DB-API in tandem,

    import pgdb
    import pg

    conn = pgdb.connect(dbname='postgres')
    db = pg.DB(conn)
    print(db.query('SELECT * FROM pg_class'))
    db.close()
    conn.close()

we get the following exception when the Python interpreter exits:

    Exception ignored in: <bound method DB.__del__ of <pg.DB object at
0x10640ce80>>
    Traceback (most recent call last):
      File "/private/tmp/venv/lib/python3.6/site-packages/pg.py", line
1575, in __del__
    TypeError: Connection is not valid

The line in question is
https://github.com/Cito/PyGreSQL/blob/8ca38358/pg.py#L1575. It looks
like the DB object is still holding onto the (now closed) pgmodule
connection object, and is trying to call set_cast_hook(None) during
its __del__ method, which fails. Other places in the DB code only
perform the set_cast_hook for _closeable connections; should __del__
do the same?

Thanks!
--Jacob
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql

Reply via email to