Skip to content

Commit

Permalink
Return a dict in the decompilation JSON, not a string with serialized…
Browse files Browse the repository at this point in the history
… JSON.
  • Loading branch information
palkeo committed May 14, 2020
1 parent 0ecc4f7 commit e689e62
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
15 changes: 6 additions & 9 deletions pano/contract.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import json
import logging

import pano.folder as folder
Expand Down Expand Up @@ -58,14 +57,12 @@ def __init__(self, functions, problems):

self.stor_defs = {}

def json(self):
return json.dumps(
{
"problems": self.problems,
"stor_defs": self.stor_defs,
"functions": [f.serialize() for f in self.functions],
}
)
def json(self) -> dict:
return {
"problems": self.problems,
"stor_defs": self.stor_defs,
"functions": [f.serialize() for f in self.functions],
}

def load(self, data):
self.problems = data["problems"]
Expand Down
4 changes: 1 addition & 3 deletions pano/decompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,7 @@ def dec():
try:
decompilation.json = contract.json()
except Exception:
# .json is a nice to have, whatever crazy error happens we should
# still proceed with the rest of decompilation
logger.exception("failed json serialization")
logger.exception("failed json dump")

text_output = io.StringIO()
with redirect_stdout(text_output):
Expand Down

0 comments on commit e689e62

Please sign in to comment.