Changes between Initial Version and Version 2 of Ticket #101


Ignore:
Timestamp:
11/10/08 09:44:47 (6 years ago)
Author:
xi
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #101 – Description

    initial v2  
    1 If I try to define a custom __slots__ for a subclass of YAMLObject I get errors during serialization because the code tries to use instance.__dict__.update, but __dict__ doesn't exist on objects with slots. 
     1If I try to define a custom {{{__slots__}}} for a subclass of {{{YAMLObject}}} I get errors during serialization because the code tries to use {{{instance.__dict__.update}}}, but {{{__dict__}}} doesn't exist on objects with slots. 
    22 
    33{{{ 
    4  
    5  
    64  File "/usr/lib/python2.4/site-packages/yaml/__init__.py", line 177, in dump 
    75    return dump_all([data], stream, Dumper=Dumper, **kwds) 
     
    1917}}} 
    2018 
    21 Attached is a patch that makes the constructor use setattr and the representer use __slots__ if __dict__ is not available. I did not write unit tests, as I couldn't figure out how to run them, but it makes the unit tests for my own project (which uses __slots__ for some objects and __dict__ for others) pass. 
     19Attached is a patch that makes the constructor use {{{setattr}}} and the representer use {{{__slots__}}} if {{{__dict__}}} is not available. I did not write unit tests, as I couldn't figure out how to run them, but it makes the unit tests for my own project (which uses {{{__slots__}}} for some objects and {{{__dict__}}} for others) pass.