From: sobolevn Date: Thu, 13 Mar 2025 10:40:42 +0000 (+0300) Subject: fix: fix `status` annotation in `connection_summary` X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1023%2Fhead;p=thirdparty%2Fpsycopg.git fix: fix `status` annotation in `connection_summary` Currently enum names are strings, but this is being changed to become Literal. When this will happen, the type inferred will not be valid anymore, as we mutate it and manipulate it as string in the function. See https://github.com/python/mypy/pull/18797 --- diff --git a/psycopg/psycopg/pq/misc.py b/psycopg/psycopg/pq/misc.py index fe06141c2..92352a40d 100644 --- a/psycopg/psycopg/pq/misc.py +++ b/psycopg/psycopg/pq/misc.py @@ -153,7 +153,7 @@ def connection_summary(pgconn: abc.PGconn) -> str: parts = [] if pgconn.status == OK: # Put together the [STATUS] - status = TransactionStatus(pgconn.transaction_status).name + status: str = TransactionStatus(pgconn.transaction_status).name if pgconn.pipeline_status: status += f", pipeline={PipelineStatus(pgconn.pipeline_status).name}"