Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Number out of range parsing a very large integer #118

Closed
akx opened this issue Jul 22, 2020 · 3 comments
Closed

Number out of range parsing a very large integer #118

akx opened this issue Jul 22, 2020 · 3 comments

Comments

@akx
Copy link
Contributor

akx commented Jul 22, 2020

orjson.loads('300000000000000000000000000000000000000000000000000000000000000000' * 5)

fails with

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
orjson.JSONDecodeError: number out of range at line 1 column 330: line 1 column 1 (char 0)

though that integer is easily representable by Python:

>>> int('300000000000000000000000000000000000000000000000000000000000000000' * 5)
300000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000000

I think this has to do with #116.

@akx akx changed the title Number out of range with a very large integer Number out of range parsing a very large integer Jul 22, 2020
@ijl
Copy link
Owner

ijl commented Jul 22, 2020

Deserializing arbitrarily large integers won't be supported.

@ijl ijl closed this as completed Jul 22, 2020
@akx
Copy link
Contributor Author

akx commented Jul 22, 2020

👍
Fair enough, but I'm curious as to why not?

@ijl
Copy link
Owner

ijl commented Jul 22, 2020

Python is odd in supporting arbitrary-precision integers. Read the implementation to see the mismatch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants