From 5756cae77253308206863588ea84a18e45b30422 Mon Sep 17 00:00:00 2001 From: BeatButton Date: Mon, 15 Feb 2021 13:00:48 -0700 Subject: [PATCH 1/2] Cast Transaction._isolation to str in __repr__ --- asyncpg/transaction.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asyncpg/transaction.py b/asyncpg/transaction.py index 4c799925..5a0f055a 100644 --- a/asyncpg/transaction.py +++ b/asyncpg/transaction.py @@ -234,7 +234,7 @@ def __repr__(self): attrs = [] attrs.append('state:{}'.format(self._state.name.lower())) - attrs.append(self._isolation) + attrs.append(str(self._isolation)) if self._readonly: attrs.append('readonly') if self._deferrable: From 1eab8cafce90a02d4b4d7927dba1116c2c214006 Mon Sep 17 00:00:00 2001 From: BeatButton Date: Mon, 15 Feb 2021 14:23:52 -0700 Subject: [PATCH 2/2] Only add isolation to repr if it's not None --- asyncpg/transaction.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/asyncpg/transaction.py b/asyncpg/transaction.py index 5a0f055a..61e23f18 100644 --- a/asyncpg/transaction.py +++ b/asyncpg/transaction.py @@ -234,7 +234,8 @@ def __repr__(self): attrs = [] attrs.append('state:{}'.format(self._state.name.lower())) - attrs.append(str(self._isolation)) + if self._isolation is not None: + attrs.append(self._isolation) if self._readonly: attrs.append('readonly') if self._deferrable: