Skip to content

Commit 2b14886

Browse files
authored
PYTHON-5540 Fix usage of text_opts for older versions of pymongocrypt (#2525)
1 parent 527cbdd commit 2b14886

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

pymongo/asynchronous/encryption.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,8 @@ async def _encrypt_helper(
935935
contention_factor=contention_factor,
936936
range_opts=range_opts_bytes,
937937
is_expression=is_expression,
938-
text_opts=text_opts_bytes,
938+
# For compatibility with pymongocrypt < 1.16:
939+
**{"text_opts": text_opts_bytes} if text_opts_bytes else {},
939940
)
940941
return decode(encrypted_doc)["v"]
941942

pymongo/synchronous/encryption.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,8 @@ def _encrypt_helper(
928928
contention_factor=contention_factor,
929929
range_opts=range_opts_bytes,
930930
is_expression=is_expression,
931-
text_opts=text_opts_bytes,
931+
# For compatibility with pymongocrypt < 1.16:
932+
**{"text_opts": text_opts_bytes} if text_opts_bytes else {},
932933
)
933934
return decode(encrypted_doc)["v"]
934935

0 commit comments

Comments
 (0)