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

Non-JSON serializable types throw an error when recorded with AppMap #283

Closed
dustinbyrne opened this issue Feb 19, 2024 · 1 comment · Fixed by #310
Closed

Non-JSON serializable types throw an error when recorded with AppMap #283

dustinbyrne opened this issue Feb 19, 2024 · 1 comment · Fixed by #310
Assignees
Labels
bug Something isn't working

Comments

@dustinbyrne
Copy link
Contributor

dustinbyrne commented Feb 19, 2024

Non-JSON serializable types can cause the application to panic.

FAILED tests/test.pt - TypeError: Object of type int64 is not JSON serializable
1 failed, 29 passed, 39 warnings in 10.53s
_appmap/generation.py:114: in default
    return json.JSONEncoder.default(self, o)

via https://appmap-group.slack.com/archives/C03GM7D2QRH/p1708366829827279

#312

@dustinbyrne dustinbyrne added the bug Something isn't working label Feb 19, 2024
@apotterri
Copy link
Collaborator

Rather than adding a special case for int64 to AppMapEncoder, we need to figure out a better way of handling unknown types.

Maybe something like

try:
    return json.JSONEncoder.default(self, o)
except TypeError:
    return repr(o) # or maybe str(o)

It would probably be good if the tests for this fix include some sort of simple app that uses numpy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants