Skip to content

Commit dcd419c

Browse files
committed
PYTHON-5310 - Fix uri_parser AttributeError when used directly
1 parent a8197a7 commit dcd419c

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

doc/changelog.rst

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Version 4.12.1 is a bug fix release.
99

1010
- Fixed a bug that could raise ``UnboundLocalError`` when creating asynchronous connections over SSL.
1111
- Fixed a bug causing SRV hostname validation to fail when resolver and resolved hostnames are identical with three domain levels.
12+
- Fixed a bug that caused direct use of ``pymongo.uri_parser`` to raise an ``AttributeError``.
1213

1314
Issues Resolved
1415
...............

pymongo/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
from pymongo.read_preferences import ReadPreference
104104
from pymongo.synchronous.collection import ReturnDocument
105105
from pymongo.synchronous.mongo_client import MongoClient
106+
from pymongo.uri_parser import * # noqa: F403
106107
from pymongo.write_concern import WriteConcern
107108

108109
version = __version__

test/test_default_exports.py

+5
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ def test_pymongo_imports(self):
209209
)
210210
from pymongo.write_concern import WriteConcern, validate_boolean
211211

212+
def test_pymongo_submodule_attributes(self):
213+
import pymongo
214+
215+
self.assertTrue(hasattr(pymongo, "uri_parser"))
216+
212217
def test_gridfs_imports(self):
213218
import gridfs
214219
from gridfs.errors import CorruptGridFile, FileExists, GridFSError, NoFile

0 commit comments

Comments
 (0)