Skip to content

type check should use isinstance instead of type() is #91

@truebit

Description

@truebit

I saw all the type check in this libary using type(xxx) is/is not.
I suggest using another built-in function: isinstance.

The main difference here is that isinstance also returns True for subclasses. More details could be found here: What are the differences between type() and isinstance()?

I got a subclass derived from dict, objectpath would raise an error.
change interpreter.py line 44 using isinstance would fix the bug.

  def setData(self, obj):
    if isinstance(obj, tuple(ITER_TYPES + [dict])):
      self.data = obj

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions