Large numbers don't work #16

Closed
runeh opened this Issue Apr 10, 2010 · 6 comments

2 participants

@runeh

Dealing with large numbers either throw OverflowError or returns -1. Twitter's tweet IDs are currently large enough to trigger this, so there are some real world use cases.

>>> yajl.dumps([11889582081])
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: long int too large to convert to int
>>> yajl.dumps([11889582082])
'[-1]'
@runeh

Did another quick test. Seems that there is some state maintained between the calls, as trying to dump the same value twice gives different results:

>>> yajl.dumps(1233333333333)
'-1'
>>> yajl.dumps(1233333333333)
Traceback (most recent call last):
  File "", line 1, in 
OverflowError: long int too large to convert to int
>>> yajl.dumps(1233333333333)
'-1'
@rtyler
Owner

Are you running this with the latest HEAD? I've added a test to try this and it's working properly for me:

>>> yajl.dumps([11889582081])
'[11889582081]'
>>> yajl.dumps([11889582082])
'[11889582082]'
@rtyler
Owner

Also, are you on a 32-bit architecture per-chance? I'm on Linux/amd64 so I'm wondering if that could be related

@rtyler
Owner

Aha! This is very much a 32-bit machine problem, see Hudson build 73, which was run against only 32-bit machines.

I'll see what I can do :)

@rtyler
Owner

Corrected with SHA: 1c276f4

@runeh

Verified fixed in master. Thanks!

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment