summary refs log tree commit diff
diff options
context:
space:
mode:
authorVincent Breitmoser <look@my.amazin.horse>2018-01-06 18:14:51 +0100
committerVincent Breitmoser <look@my.amazin.horse>2018-04-10 11:35:29 +0200
commitf4284d943aee616f3100298634a113e51c8ab27e (patch)
tree709825a0ac1b64d2e8b9e70bd9ef713af680b09f
parentFix pep8 error on psycopg2cffi hack (diff)
downloadsynapse-f4284d943aee616f3100298634a113e51c8ab27e.tar.xz
In DomainSpecificString, override __repr__ in addition to __str__
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.
-rw-r--r--synapse/types.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/synapse/types.py b/synapse/types.py
index 7cb24cecb2..cc7c182a78 100644
--- a/synapse/types.py
+++ b/synapse/types.py
@@ -169,7 +169,7 @@ class DomainSpecificString(
         except Exception:
             return False
 
-    __str__ = to_string
+    __repr__ = to_string
 
 
 class UserID(DomainSpecificString):