id	summary	reporter	owner	description	type	status	priority	component	severity	resolution	keywords	cc
278	Cannot load __hash__able objects in mapping keys	asuffiel@…	xi	"This apparently reasonable example will fail:

{{{

import yaml

class HashableThing(yaml.YAMLObject):
    yaml_tag = u'HashableThing'

    def __init__(self, name):
        self.name = name

    def __eq__(self, other):
        return isinstance(other, type(self)) and self.name == other.name

    def __hash__(self):
        return hash(self.name)

y = yaml.dump({HashableThing('thing'): True})
print y
x = yaml.load(y)
print x
}}}

because the mapping constructor will try to hash() the object when that object has not yet been fully constructed.

The obvious thing to do would be to set deep=True on the construct_object call for mapping keys, but I'm not sure whether that's always the right thing to do. The current behaviour appears to only allow builtin types to be used as mapping keys."	defect	new	normal	pyyaml	normal			
