summary refs log tree commit diff
path: root/synapse/rest/client/account.py
diff options
context:
space:
mode:
authorMaxwell G <maxwell@gtmx.me>2023-09-25 10:19:08 -0500
committerGitHub <noreply@github.com>2023-09-25 15:19:08 +0000
commit12611bfcddfe87e3bad90ef96a648acc2f1cebf3 (patch)
tree9d67371d56f1904f3098e9bf7668db71a8b631cc /synapse/rest/client/account.py
parentBump cryptography from 41.0.3 to 41.0.4 (#16362) (diff)
downloadsynapse-12611bfcddfe87e3bad90ef96a648acc2f1cebf3.tar.xz
Add support for pydantic v2 via pydantic.v1 compat module (#16332)
While maintaining support with pydantic v1.
Diffstat (limited to 'synapse/rest/client/account.py')
-rw-r--r--synapse/rest/client/account.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/synapse/rest/client/account.py b/synapse/rest/client/account.py
index 49cd0805fd..e74a87af4d 100644
--- a/synapse/rest/client/account.py
+++ b/synapse/rest/client/account.py
@@ -18,7 +18,12 @@ import random
 from typing import TYPE_CHECKING, List, Optional, Tuple
 from urllib.parse import urlparse
 
-from pydantic import StrictBool, StrictStr, constr
+from synapse._pydantic_compat import HAS_PYDANTIC_V2
+
+if TYPE_CHECKING or HAS_PYDANTIC_V2:
+    from pydantic.v1 import StrictBool, StrictStr, constr
+else:
+    from pydantic import StrictBool, StrictStr, constr
 from typing_extensions import Literal
 
 from twisted.web.server import Request