Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve RepresenterError creation #55

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/yaml/representer.py
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
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