Changeset 24


Ignore:
Timestamp:
08/14/05 07:10:08 (9 years ago)
Author:
xi
Message:

Fixed more compatibility issues for Python 2.2.

Not fixed (and probably never will be):

  • datetime.datetime
  • object.getnewargs
  • function.module
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/syck/dumpers.py

    r23 r24  
    121121 
    122122    def represent_type(self, object): 
     123        # TODO: Python 2.2 does not provide the module name of a function 
    123124        name = '%s.%s' % (object.__module__, object.__name__) 
    124125        return _syck.Scalar('', tag="tag:python.yaml.org,2002:name:"+name) 
    125126    represent_classobj = represent_type 
     127    represent_class = represent_type 
    126128    represent_function = represent_type 
    127129    represent_builtin_function_or_method = represent_type 
     
    153155        class_name = '%s.%s' % (cls.__module__, cls.__name__) 
    154156        args = () 
     157        state = {} 
    155158        if cls.__reduce__ is type.__reduce__: 
    156159            if hasattr(object, '__reduce_ex__'): 
  • trunk/tests/test_pickle.py

    r22 r24  
    8585        return self 
    8686 
     87    def __cmp__(self, other): 
     88        return cmp((type(self), self.foo, self.bar, self.baz), 
     89                (type(other), other.foo, other.bar, other.baz)) 
     90 
    8791    def __eq__(self, other): 
    8892        return type(self) is type(other) and    \ 
     
    9599        self.bar = bar 
    96100        self.baz = baz 
     101 
     102    def __cmp__(self, other): 
     103        return cmp((type(self), self.foo, self.bar, self.baz), 
     104                (type(other), other.foo, other.bar, other.baz)) 
    97105 
    98106    def __eq__(self, other): 
Note: See TracChangeset for help on using the changeset viewer.