We are pleased to announce the 4.12.1 release of PyMongo - MongoDB’s Python Driver.
Changes in Version 4.12.1 (2025/04/29)
Version 4.12.1 is a bug fix release.
- Fixed a bug that could raise
UnboundLocalError
when creating asynchronous connections over SSL. - Fixed a bug causing SRV hostname validation to fail when resolver and resolved hostnames are identical with three domain levels.
- Fixed a bug that caused direct use of
pymongo.uri_parser
to raise anAttributeError
. - Fixed a bug where clients created with connect=False and a “mongodb+srv://” connection string
could cause publicpymongo.MongoClient
andpymongo.AsyncMongoClient
attributes (topology_description,
nodes, address, primary, secondaries, arbiters) to incorrectly return a Database, leading to type
errors such as: “NotImplementedError: Database objects do not implement truth value testing or bool()”. - Fixed a bug where MongoDB cluster topology changes could cause asynchronous operations to take much longer to complete
due to holding the Topology lock while closing stale connections. - Fixed a bug that would cause AsyncMongoClient to attempt to use PyOpenSSL when available, resulting in errors such as
“pymongo.errors.ServerSelectionTimeoutError: ‘SSLContext’ object has no attribute ‘wrap_bio’”.
Issues Resolved
See the PyMongo 4.12.1 release notes in JIRA for the list of resolved issues in this release.