From c5a053df93fdc49e4f44c73f6db4063a15dbb8fb 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 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}" -- 2.47.2