While investigating PYTHON-1317 I realized that our _WriteOp subclasses do not define __slots__. This means these classes will automatically include __dict__. From the Python docs:
The action of a _slots_ declaration is limited to the class where it is defined. As a result, subclasses will have a _dict_ unless they also define _slots_ (which must only contain names of any additional slots).
https://docs.python.org/2/reference/datamodel.html#__slots__
>>> from pymongo.operations import InsertOne >>> i = InsertOne({}) >>> i.__dict__ {}
This same problem is present in a number of other class hierarchies, including _WriteResult, _ServerMode, _ServerHeartbeatEvent, and TopologyEvent. We should fix up our usage of slots so that it does what we intend.
- is depended on by
-
PYTHON-1336 Add collation support to bulk_write operations.
- Closed
-
PYTHON-1317 Deprecate Collection.initialize_unordered_bulk_op and Collection.initialize_ordered_bulk_op
- Closed