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

Use scrub mechanism to clean up odd int/long/floats #62

Merged
merged 2 commits into from
May 19, 2015
Merged

Conversation

kshep
Copy link
Contributor

@kshep kshep commented May 18, 2015

Fixes #60

@coryvirok
Copy link
Contributor

LGTM. I can do the release.

coryvirok added a commit that referenced this pull request May 19, 2015
Use scrub mechanism to clean up odd int/long/floats
@coryvirok coryvirok merged commit 2a02f63 into master May 19, 2015
elif isinstance(obj, float) and math.isnan(obj):
return 'NaN'
elif isinstance(obj, float) and math.isinf(obj):
return 'Inf'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, should this be 'Infinity'?

>>> simplejson.dumps(simplejson.loads('Inf'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/brian/env-mox/local/lib/python2.7/site-packages/simplejson/__init__.py", line 451, in loads
    return _default_decoder.decode(s)
  File "/home/brian/env-mox/local/lib/python2.7/site-packages/simplejson/decoder.py", line 406, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/home/brian/env-mox/local/lib/python2.7/site-packages/simplejson/decoder.py", line 424, in raw_decode
    raise JSONDecodeError("No JSON object could be decoded", s, idx)
simplejson.decoder.JSONDecodeError: No JSON object could be decoded: line 1 column 0 (char 0)
>>> simplejson.dumps(simplejson.loads('Infinity'))
'Infinity'

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

Successfully merging this pull request may close these issues.

Improper serialization can lead to "could not parse json" responses from the Rollbar API
3 participants