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

Commit

Permalink
Workaround typeignore in synapse.handlers.message
Browse files Browse the repository at this point in the history
grrr at not validating. Y'all need more static typing in your lives.
  • Loading branch information
David Robertson committed May 6, 2022
1 parent 88fe871 commit 5628351
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions synapse/handlers/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,7 @@ async def persist_and_notify_client_event(
# Validate a newly added alias or newly added alt_aliases.

original_alias = None
original_alt_aliases: List[str] = []
original_alt_aliases: object = []

original_event_id = event.unsigned.get("replaces_state")
if original_event_id:
Expand Down Expand Up @@ -1455,9 +1455,7 @@ async def persist_and_notify_client_event(
# If the old version of alt_aliases is of an unknown form,
# completely replace it.
if not isinstance(original_alt_aliases, (list, tuple)):
# type-ignore: although original_alt_aliases is defined as List[str],
# it may be set to `alt_aliases` from `original_event`, i.e. to any
# JSON value. Therefore this is not unreachable.
# TODO: check that the original_alt_aliases' entries are all strings
original_alt_aliases = [] # type: ignore[unreachable]

# Check that each alias is currently valid.
Expand Down

0 comments on commit 5628351

Please sign in to comment.