-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Minor - P4
-
Affects Version/s: None
-
Component/s: BSON
-
None
Detailed steps to reproduce the problem?
from bson import ObjectId oid = ObjectId("0123 0011") # 24 characters print(oid) # outputs ObjectId('01230011') ObjectId(str(oid)) # raises TypeError
Definition of done: what must be done to consider the task complete?
bytes.fromhex skips whitespace so as long as the string is still a valid byte sequence without whitespace, it parses and sets the self.__id field. A possible fix would be to confirm that the bytes are still of length 12 after converting from the string.
The exact Python version used, with patch level:
3.9.24
The exact version of PyMongo used, with patch level:
4.15.5
True
Describe how MongoDB is set up. Local vs Hosted, version, topology, load balanced, etc.
Local
The operating system and version (e.g. Windows 7, OSX 10.8, ...)
OSX 26.3.1
Web framework or asynchronous network library used, if any, with version (e.g. Django 1.7, mod_wsgi 4.3.0, gevent 1.0.1, Tornado 4.0.2, ...)
None
Security Vulnerabilities
If you’ve identified a security vulnerability in a driver or any other MongoDB project, please report it according to the instructions here