id	summary	reporter	owner	description	type	status	priority	component	severity	resolution	keywords	cc
190	PyYAML always uses pickle protocol 2 although Python 2.6 only supports 0 and 1	Marcus Lindblom Sonestedt <macke@…>	xi	"I get this when I save my data, which has no problem with pickle.dump, but bails with yaml. I haven't yet managed to dissect our data structure and find the actual problematic instance.

From the stack-trace (below), it seems as if __reduce_ex__ is called with proto=2, but py 2.6. supports only 0 and 1, and the assert in copy_reg doesn't trigger.

{{{
Traceback (most recent call last):
  File ""E:\Orsync\Apps\Orsync\src\orsync\model\tests\storage_test.py"", line 55, in testWithSubModel
    uber2 = self._copyByDumpLoad(uber)
  File ""E:\Orsync\Apps\Orsync\src\orsync\model\tests\storage_test.py"", line 14, in _copyByDumpLoad
    data = self.storage.dumps(object)
  File ""E:\Orsync\Apps\Orsync\src\orsync\model\storage.py"", line 217, in dumps
    return self.yaml.dump(stored_model)
  File ""E:\Orsync\_work\3rd\python\yaml\__init__.py"", line 175, in dump
    return dump_all([data], stream, Dumper=Dumper, **kwds)
  File ""E:\Orsync\_work\3rd\python\yaml\__init__.py"", line 165, in dump_all
    dumper.represent(data)
  File ""E:\Orsync\_work\3rd\python\yaml\representer.py"", line 33, in represent
    node = self.represent_data(data)
  File ""E:\Orsync\_work\3rd\python\yaml\representer.py"", line 62, in represent_data
    node = self.yaml_representers[data_types[0]](self, data)
  File ""E:\Orsync\_work\3rd\python\yaml\representer.py"", line 228, in represent_dict
    return self.represent_mapping(u'tag:yaml.org,2002:map', data)
  File ""E:\Orsync\_work\3rd\python\yaml\representer.py"", line 128, in represent_mapping
    node_value = self.represent_data(item_value)
  File ""E:\Orsync\_work\3rd\python\yaml\representer.py"", line 66, in represent_data
    node = self.yaml_multi_representers[data_type](self, data)
  File ""E:\Orsync\_work\3rd\python\yaml\representer.py"", line 439, in represent_object
    u'tag:yaml.org,2002:python/object:'+function_name, state)
  File ""E:\Orsync\_work\3rd\python\yaml\representer.py"", line 128, in represent_mapping
    node_value = self.represent_data(item_value)
  File ""E:\Orsync\_work\3rd\python\yaml\representer.py"", line 66, in represent_data
    node = self.yaml_multi_representers[data_type](self, data)
  File ""E:\Orsync\_work\3rd\python\yaml\representer.py"", line 413, in represent_object
    reduce = data.__reduce_ex__(2)
  File ""c:\_work\_unzip\python\python-2.6.2c1-win32.7z\python-2.6.2c1-win32\lib\copy_reg.py"", line 70, in _reduce_ex
    raise TypeError, ""can't pickle %s objects"" % base.__name__
TypeError: can't pickle int objects
}}}"	defect	new	normal	pyyaml	normal			
