Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
In DomainSpecificString, override __repr__ in addition to __str__
Browse files Browse the repository at this point in the history
For some reason, string interpolation on a DomainSpecificString object
like "%r" % (domainSpecificStringObj) fails under PyPy, because the
default __repr__ implementation wants to iterate over the object. I'm
not sure why that happens, but overriding __repr__ instead of __str__
fixes this problem, and is arguably the more appropriate thing to do
anyways.
  • Loading branch information
Valodim committed Apr 10, 2018
1 parent d1e56cf commit f4284d9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion synapse/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def is_valid(cls, s):
except Exception:
return False

__str__ = to_string
__repr__ = to_string


class UserID(DomainSpecificString):
Expand Down

0 comments on commit f4284d9

Please sign in to comment.