From 653eeb476fc356e41e9d3dd2a711ff48173fad43 Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 7 Jul 2016 12:40:50 +0000 Subject: [PATCH] runtime: fix serialization of object lists. Fixes #500. --- artiq/runtime/session.c | 7 ++++++- artiq/test/coredevice/test_embedding.py | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/artiq/runtime/session.c b/artiq/runtime/session.c index c2158d048..bbe89cb47 100644 --- a/artiq/runtime/session.c +++ b/artiq/runtime/session.c @@ -877,7 +877,12 @@ static int send_rpc_value(const char **tag, void **value) case 'O': { // host object struct { uint32_t id; } **object = *value; - return out_packet_int32((*object)->id); + + if(!out_packet_int32((*object)->id)) + return 0; + + *value = (void*)((intptr_t)(*value) + sizeof(*object)); + break; } default: diff --git a/artiq/test/coredevice/test_embedding.py b/artiq/test/coredevice/test_embedding.py index 1ad29201f..1edb73fa4 100644 --- a/artiq/test/coredevice/test_embedding.py +++ b/artiq/test/coredevice/test_embedding.py @@ -48,6 +48,9 @@ class RoundtripTest(ExperimentCase): obj = object() self.assertRoundtrip(obj) + def test_object_list(self): + self.assertRoundtrip([object(), object()]) + class _DefaultArg(EnvExperiment): def build(self):