Skip to content

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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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