From 33bd9f2bac40da24a261fdaa078db3ee331e012f 2011-04-08 00:38:23 From: MinRK <benjaminrk@gmail.com> Date: 2011-04-08 00:38:23 Subject: [PATCH] pickle length-0 arrays. --- diff --git a/IPython/utils/newserialized.py b/IPython/utils/newserialized.py index b75430e..b08845c 100644 --- a/IPython/utils/newserialized.py +++ b/IPython/utils/newserialized.py @@ -94,8 +94,10 @@ class SerializeIt(object): self.data = None self.obj = unSerialized.getObject() if globals().has_key('numpy') and isinstance(self.obj, numpy.ndarray): - if len(self.obj) == 0: # length 0 arrays can't be reconstructed - raise SerializationError("You cannot send a length 0 array") + if len(self.obj.shape) == 0: # length 0 arrays are just pickled + self.typeDescriptor = 'pickle' + self.metadata = {} + else: self.obj = numpy.ascontiguousarray(self.obj, dtype=None) self.typeDescriptor = 'ndarray' self.metadata = {'shape':self.obj.shape, diff --git a/IPython/zmq/parallel/engine.py b/IPython/zmq/parallel/engine.py index db32572..08e9b98 100755 --- a/IPython/zmq/parallel/engine.py +++ b/IPython/zmq/parallel/engine.py @@ -61,7 +61,6 @@ class EngineFactory(RegistrationFactory): ctx = self.context loop = self.loop identity = self.ident - print (identity) idents,msg = self.session.feed_identities(msg) msg = Message(self.session.unpack_message(msg))