-
Notifications
You must be signed in to change notification settings - Fork 12
Closed
Description
If you attempt to parse code that contains a mapping with an unhashable key, yaml raises a ConstructorError that tells the user exactly where the issue was. However, oyaml raises a TypeError, which may be missed by exception handling code expecting a ConstructorError, and which contains no information about where the problem occurred.
>>> def test():
... try:
... yaml.safe_load("{foo: bar}: baz")
... except Exception as e:
... print("%s: %s" % (type(e).__name__, e))
...
>>> import yaml
>>> test()
ConstructorError: while constructing a mapping
found unacceptable key (unhashable type: 'dict')
in "<string>", line 1, column 1:
{foo: bar}: baz
^
>>> import oyaml
>>> test()
TypeError: unhashable type: 'OrderedDict'
Metadata
Metadata
Assignees
Labels
No labels