From 1860364778b8a00b06e2c42e19eb1d8d8fd4464f Mon Sep 17 00:00:00 2001 From: whitequark Date: Mon, 14 Dec 2015 16:26:02 +0800 Subject: [PATCH] protocols.pyon: support artiq.int (fixes #188). --- artiq/protocols/pyon.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/artiq/protocols/pyon.py b/artiq/protocols/pyon.py index 9bdde5a9c..8c4afbbdc 100644 --- a/artiq/protocols/pyon.py +++ b/artiq/protocols/pyon.py @@ -24,7 +24,7 @@ import os import tempfile import numpy - +from ..language.core import int as wrapping_int _encode_map = { type(None): "none", @@ -36,6 +36,7 @@ _encode_map = { tuple: "tuple", list: "list", dict: "dict", + wrapping_int: "number", Fraction: "fraction", OrderedDict: "ordereddict", numpy.ndarray: "nparray" @@ -69,7 +70,7 @@ class _Encoder: return "false" def encode_number(self, x): - return str(x) + return repr(x) def encode_str(self, x): # Do not use repr() for JSON compatibility. @@ -168,6 +169,7 @@ _eval_dict = { "false": False, "true": True, + "int": wrapping_int, "Fraction": Fraction, "OrderedDict": OrderedDict, "nparray": _nparray,