Changeset 350


Ignore:
Timestamp:
08/29/09 15:15:31 (5 years ago)
Author:
xi
Message:

Fixed a problem when CDumper incorrectly serializes a node anchor.

Location:
pyyaml/trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • pyyaml/trunk/ext/_yaml.pyx

    r348 r350  
    13811381        anchor = NULL 
    13821382        if anchor_object is not None: 
    1383             anchor = PyString_AS_STRING(PyUnicode_AsUTF8String(anchor_object)) 
     1383            if PyUnicode_CheckExact(anchor_object): 
     1384                anchor_object = PyUnicode_AsUTF8String(anchor_object) 
     1385            if not PyString_CheckExact(anchor_object): 
     1386                if PY_MAJOR_VERSION < 3: 
     1387                    raise TypeError("anchor must be a string") 
     1388                else: 
     1389                    raise TypeError(u"anchor must be a string") 
     1390            anchor = PyString_AS_STRING(anchor_object) 
    13841391        if node in self.serialized_nodes: 
    13851392            if yaml_alias_event_initialize(&event, anchor) == 0: 
  • pyyaml/trunk/tests/lib/test_constructor.py

    r330 r350  
    1818            AnObject, AnInstance, AState, ACustomState, InitArgs, InitArgsWithState,    \ 
    1919            NewArgs, NewArgsWithState, Reduce, ReduceWithState, MyInt, MyList, MyDict,  \ 
    20             FixedOffset, execute 
     20            FixedOffset, today, execute 
    2121 
    2222    class MyLoader(yaml.Loader): 
     
    213213        def dst(self, dt): 
    214214            return datetime.timedelta(0) 
     215 
     216    today = datetime.date.today() 
    215217 
    216218def _load_code(expression): 
  • pyyaml/trunk/tests/lib3/test_constructor.py

    r330 r350  
    1515            AnObject, AnInstance, AState, ACustomState, InitArgs, InitArgsWithState,    \ 
    1616            NewArgs, NewArgsWithState, Reduce, ReduceWithState, MyInt, MyList, MyDict,  \ 
    17             FixedOffset, execute 
     17            FixedOffset, today, execute 
    1818 
    1919    class MyLoader(yaml.Loader): 
     
    200200        def dst(self, dt): 
    201201            return datetime.timedelta(0) 
     202 
     203    today = datetime.date.today() 
    202204 
    203205def _load_code(expression): 
Note: See TracChangeset for help on using the changeset viewer.