Skip to content

Function istext sometimes gives wrong results #154

Description

In a specific setup (did not have time to investigate the root cause or come up with a minimal example, in my specific case it happens in the json module that tries to sort keys) I end up with a list of objects (all strings), but of different types that the istext function wrongly reports to be not of text type.

It raises the following exceptions in the compare methods (__lt__, ...) because istext returns False:

exceptions.TypeError: ("unorderable types: str() and <type 'str'>",)

This can be fixed by changing the check in the (deprecated) method istext in utils/__init__.py to

return isinstance(obj, type(u'')) or isinstance(obj, str)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions