Demonstrate issue 1062277 if you serialize the command stack first
authorW. Trevor King <wking@drexel.edu>
Sat, 21 Aug 2010 17:25:44 +0000 (13:25 -0400)
committerW. Trevor King <wking@drexel.edu>
Sat, 21 Aug 2010 17:25:44 +0000 (13:25 -0400)
hooke/curve.py

index 9f92e59..5a32e6d 100644 (file)
@@ -197,6 +197,34 @@ class Curve (object):
     name: path
     path: some/path
     <BLANKLINE>
     name: path
     path: some/path
     <BLANKLINE>
+
+    However, if we try and serialize the command stack first, we run
+    into `Python issue 1062277`_.
+
+    .. _Python issue 1062277: http://bugs.python.org/issue1062277
+
+    >>> pickle.dumps(c.command_stack)
+    Traceback (most recent call last):
+      ...
+        assert id(obj) not in self.memo
+    AssertionError
+
+    YAML still works, though.
+
+    >>> print yaml.dump(c.command_stack)
+    &id001 !!python/object/new:hooke.command_stack.CommandStack
+    listitems:
+    - !!python/object:hooke.engine.CommandMessage
+      arguments:
+        curve: !!python/object:hooke.curve.Curve
+          command_stack: *id001
+          data: null
+          driver: null
+          info: {}
+          name: path
+          path: some/path
+      command: curve info
+    <BLANKLINE>
     """
     def __init__(self, path, info=None):
         #the data dictionary contains: {name of data: list of data sets [{[x], [y]}]
     """
     def __init__(self, path, info=None):
         #the data dictionary contains: {name of data: list of data sets [{[x], [y]}]