Skip to content

Commit c2b2cc3

Browse files
committed
fix typing and add comment in encryption
1 parent bdaf87a commit c2b2cc3

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

pymongo/asynchronous/encryption.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,7 @@ def __init__(self, client: AsyncMongoClient[_DocumentTypeArg], opts: AutoEncrypt
398398
encrypted_fields_map = _dict_to_bson(opts._encrypted_fields_map, False, _DATA_KEY_OPTS)
399399
self._bypass_auto_encryption = opts._bypass_auto_encryption
400400
self._internal_client = None
401+
# parsing kms_ssl_contexts here so that parsing errors will be raised before internal clients are created
401402
opts._kms_ssl_contexts(_IS_SYNC)
402403

403404
def _get_internal_client(

pymongo/encryption_options.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,8 @@ def __init__(
239239
self._mongocryptd_spawn_args.append("--idleShutdownTimeoutSecs=60")
240240
# Maps KMS provider name to a SSLContext.
241241
self._kms_tls_options = kms_tls_options
242-
self._sync_kms_ssl_contexts: dict[str, SSLContext] = None # type:ignore[assignment]
243-
self._async_kms_ssl_contexts: dict[str, SSLContext] = None # type:ignore[assignment]
242+
self._sync_kms_ssl_contexts: Optional[dict[str, SSLContext]] = None
243+
self._async_kms_ssl_contexts: Optional[dict[str, SSLContext]] = None
244244
self._bypass_query_analysis = bypass_query_analysis
245245
self._key_expiration_ms = key_expiration_ms
246246

pymongo/synchronous/encryption.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ def __init__(self, client: MongoClient[_DocumentTypeArg], opts: AutoEncryptionOp
395395
encrypted_fields_map = _dict_to_bson(opts._encrypted_fields_map, False, _DATA_KEY_OPTS)
396396
self._bypass_auto_encryption = opts._bypass_auto_encryption
397397
self._internal_client = None
398+
# parsing kms_ssl_contexts here so that parsing errors will be raised before internal clients are created
398399
opts._kms_ssl_contexts(_IS_SYNC)
399400

400401
def _get_internal_client(

0 commit comments

Comments
 (0)