Skip to content

Exception in Destructor #591

@DasCapschen

Description

@DasCapschen

When a Postgres Connection is deleted, it encounters an Exception in its Constructor, which is fortunately ignored.
Yet it is a little concerning, that the destructor does not finish successfully.

Code is approximately:

connection = create_postgres_connection()
db_migrator = Migrator(connection=connection)
db_migrator.migrate()
connection.close()
# script ends and destructor is called

The error message is:

Exception ignored in: <function BaseConnection.__del__ at 0x7f6c249bdbc0>
Traceback (most recent call last):
  File "/opt/maddox/.venv/lib/python3.11/site-packages/psycopg/connection.py", line 157, in __del__
  File "/opt/maddox/.venv/lib/python3.11/site-packages/psycopg/connection.py", line 164, in __repr__
AttributeError: 'NoneType' object has no attribute 'connection_summary'

Versions are:

  • Python 3.11.4
  • Psycopg 3.1.9
  • libpg 15.3 (Debian)
  • Postgres 15.2 (Alpine Docker Container)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions