Skip to content

Segfault when doing a repr(self) on a not-yet initialized connection object #361

@a1exsh

Description

@a1exsh

The following code segfaults on connection_repr(), because self->dsn is not set yet:

class conn2(psycopg2.extensions.connection):
    def __init__(conn, *args, **kwargs):
        print(repr(conn))
        super(psycopg2.extensions.connection, conn).__init__(*args, **kwargs)
psycopg2.connect('', connection_factory=conn2)

Do we want to fix this? Just add a check like self->dsn ? self->dsn : "None"?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions