Skip to content

Commit

Permalink
Improve RepresenterError creation
Browse files Browse the repository at this point in the history
  • Loading branch information
bondarevts authored and sigmavirus24 committed Aug 8, 2017
1 parent 2c55eb6 commit ef744d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/yaml/representer.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def represent_yaml_object(self, tag, data, cls, flow_style=None):
return self.represent_mapping(tag, state, flow_style=flow_style)

def represent_undefined(self, data):
raise RepresenterError("cannot represent an object: %s" % data)
raise RepresenterError("cannot represent an object", data)

SafeRepresenter.add_representer(type(None),
SafeRepresenter.represent_none)
Expand Down Expand Up @@ -411,7 +411,7 @@ def represent_object(self, data):
elif hasattr(data, '__reduce__'):
reduce = data.__reduce__()
else:
raise RepresenterError("cannot represent object: %r" % data)
raise RepresenterError("cannot represent an object", data)
reduce = (list(reduce)+[None]*5)[:5]
function, args, state, listitems, dictitems = reduce
args = list(args)
Expand Down
4 changes: 2 additions & 2 deletions lib3/yaml/representer.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ def represent_yaml_object(self, tag, data, cls, flow_style=None):
return self.represent_mapping(tag, state, flow_style=flow_style)

def represent_undefined(self, data):
raise RepresenterError("cannot represent an object: %s" % data)
raise RepresenterError("cannot represent an object", data)

SafeRepresenter.add_representer(type(None),
SafeRepresenter.represent_none)
Expand Down Expand Up @@ -316,7 +316,7 @@ def represent_object(self, data):
elif hasattr(data, '__reduce__'):
reduce = data.__reduce__()
else:
raise RepresenterError("cannot represent object: %r" % data)
raise RepresenterError("cannot represent an object", data)
reduce = (list(reduce)+[None]*5)[:5]
function, args, state, listitems, dictitems = reduce
args = list(args)
Expand Down

0 comments on commit ef744d8

Please sign in to comment.