From 6a1706b8727cb262a3ae3819bfe0a6067d42c798 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 201c79dee..ea3a35713 100644 --- a/artiq/runtime/session.c +++ b/artiq/runtime/session.c @@ -876,7 +876,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 3ab53cb91..0c1025ed2 100644 --- a/artiq/test/coredevice/test_embedding.py +++ b/artiq/test/coredevice/test_embedding.py @@ -43,6 +43,9 @@ class RoundtripTest(ExperimentCase): obj = object() self.assertRoundtrip(obj) + def test_object_list(self): + self.assertRoundtrip([object(), object()]) + class _DefaultArg(EnvExperiment): def build(self):