diff --git a/changelog.d/9985.misc b/changelog.d/9985.misc new file mode 100644 index 0000000000000000000000000000000000000000..97bd747f2653d02b9b0d1835cc86179fa902d87e --- /dev/null +++ b/changelog.d/9985.misc @@ -0,0 +1 @@ +Simplify a few helper functions. diff --git a/synapse/util/stringutils.py b/synapse/util/stringutils.py index 40cd51a8cac8daa76cb1a0e85ab49ae8513dc288..f029432191202157df681c304b8b11c5d14ce0e4 100644 --- a/synapse/util/stringutils.py +++ b/synapse/util/stringutils.py @@ -55,9 +55,7 @@ def random_string_with_symbols(length: int) -> str: def is_ascii(s: bytes) -> bool: try: s.decode("ascii").encode("ascii") - except UnicodeDecodeError: - return False - except UnicodeEncodeError: + except UnicodeError: return False return True