Skip to content

Avoid TypeError in Transaction.__repr__ - #703

Merged
elprans merged 2 commits into
MagicStack:masterfrom
BeatButton:transaction-repl
Mar 8, 2021
Merged

Avoid TypeError in Transaction.__repr__#703
elprans merged 2 commits into
MagicStack:masterfrom
BeatButton:transaction-repl

Conversation

@BeatButton

Copy link
Copy Markdown
Contributor

Fixes#702

Comment threadasyncpg/transaction.py Outdated
attrs.append('state:{}'.format(self._state.name.lower()))

attrs.append(self._isolation)
attrs.append(str(self._isolation))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if self._isolation is not None would be more appropriate here.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right, that is indeed more consistent with the rest of the repr.

@BeatButtonBeatButton changed the title Cast Transaction._isolation to str in __repr__Avoid TypeError in Transaction.__repr__Feb 15, 2021
@elprans
elprans merged commit d6eea8e into MagicStack:masterMar 8, 2021
@elpranselprans mentioned this pull request May 17, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Default isolation level None breaks Transaction.__repr__

2 participants

@BeatButton@elprans