From 10de931680c7da8f403fd30527fc9ec0abb14c45 Mon Sep 17 00:00:00 2001 From: "Jeffrey A. Clark" Date: Thu, 11 Sep 2025 16:37:22 -0400 Subject: [PATCH 1/4] PYTHON-5543 PyMongoBaseProtocol should inherit from asyncio.BaseProtocol (#2528) Co-authored-by: Noah Stapp --- doc/changelog.rst | 4 +++- pymongo/network_layer.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index cf84843eb7..64168c9654 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -10,6 +10,9 @@ Version 4.15.1 is a bug fix release. that would cause a ``TypeError`` when using ``pymongocrypt<1.16`` by passing an unsupported ``type_opts`` parameter even if Queryable Encryption text queries beta was not used. +- Fixed a bug in ``AsyncMongoClient`` that caused a + ``ServerSelectionTimeoutError`` when used with ``uvicorn``, ``FastAPI``, or ``uvloop``. + Issues Resolved ............... @@ -18,7 +21,6 @@ in this release. .. _PyMongo 4.15.1 release notes in JIRA: https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=10004&version=46486 - Changes in Version 4.15.0 (2025/09/10) -------------------------------------- diff --git a/pymongo/network_layer.py b/pymongo/network_layer.py index 605b8dde9b..9173130776 100644 --- a/pymongo/network_layer.py +++ b/pymongo/network_layer.py @@ -22,7 +22,7 @@ import struct import sys import time -from asyncio import BaseTransport, BufferedProtocol, Future, Protocol, Transport +from asyncio import BaseProtocol, BaseTransport, BufferedProtocol, Future, Transport from typing import ( TYPE_CHECKING, Any, @@ -250,7 +250,7 @@ def recv_into(self, buffer: bytes) -> int: return self.conn.recv_into(buffer) -class PyMongoBaseProtocol(Protocol): +class PyMongoBaseProtocol(BaseProtocol): def __init__(self, timeout: Optional[float] = None): self.transport: Transport = None # type: ignore[assignment] self._timeout = timeout From 1eb824aab61fed2c01735ba0e65b8ee85c7f24af Mon Sep 17 00:00:00 2001 From: "Jeffrey A. Clark" Date: Thu, 11 Sep 2025 18:23:26 -0400 Subject: [PATCH 2/4] Upgrade setup-python action --- .github/workflows/codeql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 8dffe1fa7b..2c69eaf3a2 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -42,7 +42,7 @@ jobs: with: ref: ${{ inputs.ref }} persist-credentials: false - - uses: actions/setup-python@v5 + - uses: actions/setup-python@v6 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL From dcf9cb995760367a5bd8e118881a18f290df990b Mon Sep 17 00:00:00 2001 From: "Jeffrey A. Clark" Date: Fri, 12 Sep 2025 08:27:47 -0400 Subject: [PATCH 3/4] Revert "Upgrade setup-python action" This reverts commit 1eb824aab61fed2c01735ba0e65b8ee85c7f24af. --- .github/workflows/codeql.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 2c69eaf3a2..8dffe1fa7b 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -42,7 +42,7 @@ jobs: with: ref: ${{ inputs.ref }} persist-credentials: false - - uses: actions/setup-python@v6 + - uses: actions/setup-python@v5 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL From ee0afac96f06420c1bb056c31f1fcc7955a7d9af Mon Sep 17 00:00:00 2001 From: "Jeffrey A. Clark" Date: Fri, 12 Sep 2025 08:30:19 -0400 Subject: [PATCH 4/4] Fix changelog formatting --- doc/changelog.rst | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index 64168c9654..c8e17bc30b 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -6,12 +6,14 @@ Changes in Version 4.15.1 (2025/09/11) Version 4.15.1 is a bug fix release. - - Fixed a bug in :meth:`~pymongo.synchronous.encryption.ClientEncryption.encrypt` and :meth:`~pymongo.asynchronous.encryption.AsyncClientEncryption.encrypt` - that would cause a ``TypeError`` when using ``pymongocrypt<1.16`` by passing an unsupported ``type_opts`` parameter even if - Queryable Encryption text queries beta was not used. +- Fixed a bug in :meth:`~pymongo.synchronous.encryption.ClientEncryption.encrypt` + and :meth:`~pymongo.asynchronous.encryption.AsyncClientEncryption.encrypt` + that would cause a ``TypeError`` when using ``pymongocrypt<1.16`` by passing + an unsupported ``type_opts`` parameter even if Queryable Encryption text + queries beta was not used. -- Fixed a bug in ``AsyncMongoClient`` that caused a - ``ServerSelectionTimeoutError`` when used with ``uvicorn``, ``FastAPI``, or ``uvloop``. +- Fixed a bug in ``AsyncMongoClient`` that caused a ``ServerSelectionTimeoutError`` + when used with ``uvicorn``, ``FastAPI``, or ``uvloop``. Issues Resolved ............... @@ -33,8 +35,10 @@ PyMongo 4.15 brings a number of changes including: :attr:`~pymongo.encryption.QueryType.SUBSTRINGPREVIEW`, as part of the experimental Queryable Encryption text queries beta. ``pymongocrypt>=1.16`` is required for text query support. -- Added :class:`bson.decimal128.DecimalEncoder` and :class:`bson.decimal128.DecimalDecoder` - to support encoding and decoding of BSON Decimal128 values to decimal.Decimal values using the TypeRegistry API. +- Added :class:`bson.decimal128.DecimalEncoder` and + :class:`bson.decimal128.DecimalDecoder` + to support encoding and decoding of BSON Decimal128 values to + decimal.Decimal values using the TypeRegistry API. - Added support for Windows ``arm64`` wheels. Changes in Version 4.14.1 (2025/08/19) @@ -42,8 +46,9 @@ Changes in Version 4.14.1 (2025/08/19) Version 4.14.1 is a bug fix release. - - Fixed a bug in ``MongoClient.append_metadata()`` and ``AsyncMongoClient.append_metadata()`` - that allowed duplicate ``DriverInfo.name`` to be appended to the metadata. +- Fixed a bug in ``MongoClient.append_metadata()`` and + ``AsyncMongoClient.append_metadata()`` + that allowed duplicate ``DriverInfo.name`` to be appended to the metadata. Issues Resolved ...............