If I attempt to reproduce this code in the repl, I get a different result because TypeErrors are printed/logged:
Python 3.10.7 (main, Sep 20 2022, 21:11:14) [Clang 14.0.0 (clang-1400.0.29.102)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import orjson
>>> orjson.dumps(9007199254740992)
b'9007199254740992'
>>> orjson.dumps(9007199254740992, option=orjson.OPT_STRICT_INTEGER)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Integer exceeds 53-bit range
>>> orjson.dumps(-9007199254740992, option=orjson.OPT_STRICT_INTEGER)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Integer exceeds 53-bit range
>>> orjson.dumps(2**64)
OverflowError: int too big to convert
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Integer exceeds 64-bit range
>>> orjson.__version__
'3.10.6'
This may be related to https://github.com/ijl/orjson/issues/238 which points out that the two exception types are aliases of each other. The actionable request here is to update either documentation or code in such a way that the output in REPL and logs matches the documentation.
The documentation states that for integers that are too large:
If I attempt to reproduce this code in the repl, I get a different result because TypeErrors are printed/logged:
This may be related to https://github.com/ijl/orjson/issues/238 which points out that the two exception types are aliases of each other. The actionable request here is to update either documentation or code in such a way that the output in REPL and logs matches the documentation.