Currently the C extensions will raise bson.errors.InvalidDocument, which is later converted to bson.errors.InvalidBSON, with the message "no c decoder for this type yet" when encountering an unknown (or corrupt) type byte. The pure python decoder (in both PyMongo 2.x and 3.x) will raise KeyError due to a failed dict lookup.
The pure python behavior is completely broken. It should raise InvalidBSON. The C version should also raise InvalidBSON directly, avoiding the later conversion. Both C and pure python should use the message defined in DRIVERS-281.
Note that this is currently a minor bug that would only be a problem when decoding corrupt BSON. However, MongoDB 3.4 will introduce a few new BSON types not yet supported by PyMongo.
- is depended on by
-
DRIVERS-281 Rephrase unsupported/corrupt BSON messages
- Closed