summary refs log tree commit diff
path: root/synapse
diff options
context:
space:
mode:
authorDavid Robertson <davidr@element.io>2022-10-03 14:26:49 +0100
committerGitHub <noreply@github.com>2022-10-03 13:26:49 +0000
commita423f452942c5b1597c29be50b235c8df4d6c93d (patch)
tree63fcbcfbc1e2a50379442f97af52bbd6bb164935 /synapse
parentBump actions/checkout from 2 to 3 (#13982) (diff)
downloadsynapse-a423f452942c5b1597c29be50b235c8df4d6c93d.tar.xz
Fix twisted trunk mypy errors (#14012)
Diffstat (limited to 'synapse')
-rw-r--r--synapse/handlers/cas.py3
-rw-r--r--synapse/handlers/ui_auth/checkers.py3
2 files changed, 6 insertions, 0 deletions
diff --git a/synapse/handlers/cas.py b/synapse/handlers/cas.py
index 7163af8004..fc467bc7c1 100644
--- a/synapse/handlers/cas.py
+++ b/synapse/handlers/cas.py
@@ -130,6 +130,9 @@ class CasHandler:
         except PartialDownloadError as pde:
             # Twisted raises this error if the connection is closed,
             # even if that's being used old-http style to signal end-of-data
+            # Assertion is for mypy's benefit. Error.response is Optional[bytes],
+            # but a PartialDownloadError should always have a non-None response.
+            assert pde.response is not None
             body = pde.response
         except HttpResponseException as e:
             description = (
diff --git a/synapse/handlers/ui_auth/checkers.py b/synapse/handlers/ui_auth/checkers.py
index a744d68c64..332edcca24 100644
--- a/synapse/handlers/ui_auth/checkers.py
+++ b/synapse/handlers/ui_auth/checkers.py
@@ -119,6 +119,9 @@ class RecaptchaAuthChecker(UserInteractiveAuthChecker):
         except PartialDownloadError as pde:
             # Twisted is silly
             data = pde.response
+            # For mypy's benefit. A general Error.response is Optional[bytes], but
+            # a PartialDownloadError.response should be bytes AFAICS.
+            assert data is not None
             resp_body = json_decoder.decode(data.decode("utf-8"))
 
         if "success" in resp_body: