From a9434d2e9f48e8e03adfe137e9f2869fd953d830 Mon Sep 17 00:00:00 2001 From: Robert Jordens Date: Sat, 21 May 2016 18:57:44 +0200 Subject: [PATCH] pyon: use dtype.str * contains endianess, makes this portable * it's shorter * it's what the numpy array interfaces uses * this is otherwise backwards and forwards compatible --- artiq/protocols/pyon.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/artiq/protocols/pyon.py b/artiq/protocols/pyon.py index 922b94a1b..394965434 100644 --- a/artiq/protocols/pyon.py +++ b/artiq/protocols/pyon.py @@ -140,14 +140,14 @@ class _Encoder: def encode_nparray(self, x): r = "nparray(" r += self.encode(x.shape) + ", " - r += self.encode(str(x.dtype)) + ", " + r += self.encode(x.dtype.str) + ", " r += self.encode(base64.b64encode(x).decode()) r += ")" return r def encode_npscalar(self, x): r = "npscalar(" - r += "\"" + type(x).__name__ + "\", " + r += self.encode(x.dtype.str) + ", " r += self.encode(base64.b64encode(x).decode()) r += ")" return r