Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Possible RecursionError in KeywordResult._handle_return_value() #57

Copy link
Copy link
@tw39124-1

Description

@tw39124-1
Issue body actions

KeywordResult._handle_return_value() calls itself as part of a list-comprehension if ret does not get handled by the initial if-statements:

def _handle_return_value(self, ret):
    if isinstance(ret, (str, unicode, bytes)):
        return self._handle_binary_result(ret)
    if isinstance(ret, (int, long, float)):
        return ret
    if isinstance(ret, Mapping):
        return dict((self._str(key), self._handle_return_value(value))
                    for key, value in ret.items())
    try:
        return [self._handle_return_value(item) for item in ret]
    except TypeError:
        return self._str(ret)

However, in this case ret is an object provided by a library, which happens to return itself when __getitem__ is called. _handle_return_value then enters an infinite recursion, which eventually causes the interpreter to raise a RecursionError. Should the list comprehension be inside an if-clause which checks that the object is actually a list-like object?

To get around this for now I am pickling and base64-encoding the object to a string and returning that, but that means I have to decode and de-pickle it back into an object on the client side. It would be nice if I didn't have to do this and could just return an object from my remote keyword without this issue.

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.