From b6ead96af9cb36d3e8007f512383042fe35788f5 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Thu, 13 Mar 2025 13:40:42 +0300 Subject: [PATCH] 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 --- psycopg/psycopg/pq/misc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/psycopg/psycopg/pq/misc.py b/psycopg/psycopg/pq/misc.py index 1decf4b79..31be494a0 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}" -- 2.47.3