Skip to content

Commit

Permalink
Merge pull request #304 from jakevdp/callable-repr
Browse files Browse the repository at this point in the history
Avoid noisy JSON seralization warning for callables (e.g. numpy ufuncs)
  • Loading branch information
asmeurer authored Nov 14, 2024
2 parents 266dc7e + 8a98bb1 commit a3f3f37
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def to_json_serializable(o):
return tuple(to_json_serializable(i) for i in o)
if isinstance(o, list):
return [to_json_serializable(i) for i in o]
if callable(o):
return repr(o)

# Ensure everything is JSON serializable. If this warning is issued, it
# means the given type needs to be added above if possible.
Expand Down

0 comments on commit a3f3f37

Please sign in to comment.