Repository navigation
PYTHON-6027 Consolidate non-IO code in Topology into shared base class - #3107
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Existing test helpers still access the removed name-mangled events executor attribute.
1 open finding
What changed in this PR
Consolidates duplicated synchronous/asynchronous topology logic into a shared base class.
Changes:
- Adds generic pool typing.
- Extracts common topology state and methods.
- Retains I/O-specific behavior in concrete topology classes.
| File | Description |
|---|---|
pymongo/typings.py |
Adds shared pool typing. |
pymongo/topology_shared.py |
Introduces the shared topology base. |
pymongo/synchronous/topology.py |
Uses the shared base. |
pymongo/asynchronous/topology.py |
Uses the shared base. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Assigned |
|
|
||
|
|
||
| class _ErrorContext: | ||
| """An error with context for SDAM error handling.""" |
There was a problem hiding this comment.
Now a private method so maybe:
"Shared base for the sync and async classes."
There was a problem hiding this comment.
i assume this comment is for _AgnosticTopologyBase? and if so, fixed in 47d6c9c (it didnt make sense for _ErrorContext imo)

PYTHON-6027
Changes in this PR
Test Plan
Checklist
Checklist for Author
Checklist for Reviewer