Re: [PyGreSQL] "TypeError: Connection is not valid" on exit from Python
Am 03.01.2019 um 18:10 schrieb Jacob Champion: > Bump. Is anyone else able to reproduce this exit exception, and does > the proposed fix make sense? Thank you Jacob. I have created a GitHub issue here and will look into this later: https://github.com/Cito/PyGreSQL/issues/11 -- Christoph ___ PyGreSQL mailing list PyGreSQL@Vex.Net https://mail.vex.net/mailman/listinfo/pygresql
Re: [PyGreSQL] "TypeError: Connection is not valid" on exit from Python
On Thu, Sep 13, 2018 at 3:02 PM Jacob Champion wrote: > With the following reproduction script, which uses the classic API and > DB-API in tandem, > [...] > we get the following exception when the Python interpreter exits: Bump. Is anyone else able to reproduce this exit exception, and does the proposed fix make sense? --Jacob ___ PyGreSQL mailing list PyGreSQL@Vex.Net https://mail.vex.net/mailman/listinfo/pygresql
[PyGreSQL] "TypeError: Connection is not valid" on exit from Python
[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: > 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 PyGreSQL@vex.net https://mail.vex.net/mailman/listinfo.cgi/pygresql