Skip to content

Commit

Permalink
protocols.pyon: support artiq.int (fixes #188).
Browse files Browse the repository at this point in the history
whitequark committed Dec 14, 2015
1 parent b5f2e17 commit 1860364
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions artiq/protocols/pyon.py
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@
import tempfile

import numpy

from ..language.core import int as wrapping_int

_encode_map = {
type(None): "none",
@@ -36,6 +36,7 @@
tuple: "tuple",
list: "list",
dict: "dict",
wrapping_int: "number",
Fraction: "fraction",
OrderedDict: "ordereddict",
numpy.ndarray: "nparray"
@@ -69,7 +70,7 @@ def encode_bool(self, x):
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 @@ def _npscalar(ty, data):
"false": False,
"true": True,

"int": wrapping_int,
"Fraction": Fraction,
"OrderedDict": OrderedDict,
"nparray": _nparray,

0 comments on commit 1860364

Please sign in to comment.