Limit length in use_ascii mode

This commit is contained in:
Zac Hatfield-Dodds 2022-10-08 00:12:53 -07:00 committed by GitHub
parent c3726bcaa2
commit d5ed3e1aaa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -59,9 +59,9 @@ class SafeRepr(reprlib.Repr):
def repr(self, x: object) -> str: def repr(self, x: object) -> str:
try: try:
if self.use_ascii: if self.use_ascii:
return ascii(x) s = ascii(x)
else:
s = super().repr(x) s = super().repr(x)
except (KeyboardInterrupt, SystemExit): except (KeyboardInterrupt, SystemExit):
raise raise
except BaseException as exc: except BaseException as exc: