From e689e62096d8989809d3b2d9417bb8fb0313788e Mon Sep 17 00:00:00 2001 From: palkeo Date: Thu, 14 May 2020 22:08:05 +1200 Subject: [PATCH] Return a dict in the decompilation JSON, not a string with serialized JSON. --- pano/contract.py | 15 ++++++--------- pano/decompiler.py | 4 +--- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/pano/contract.py b/pano/contract.py index 87651908..b3b5ebeb 100644 --- a/pano/contract.py +++ b/pano/contract.py @@ -1,4 +1,3 @@ -import json import logging import pano.folder as folder @@ -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"] diff --git a/pano/decompiler.py b/pano/decompiler.py index 7e1e0bd2..f5bbb53f 100644 --- a/pano/decompiler.py +++ b/pano/decompiler.py @@ -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):