Skip to content

Cannot expand attributes of int subclass in Variables, Watch or Debug Console #1756

@laundmo

Description

@laundmo

Problem

Subclasses of int (and other "primitives") cannot be expanded and their attributes cannot be inspected.

Reproduction

Debug this python file:

class SomeIntSubclass(int):
    def some_method(self):
        pass


class SomeClass:
    def some_method(self):
        pass


normal_instance = SomeClass()
int_instance = SomeIntSubclass(1)
breakpoint()

As you can see, there's no toggle to expand/collapse the attributes list
Image
Image

Solutions

I've orderd solutions i can think of in order of preference

  • Instead of using isinstance(x, int) or a equivalent to check whether a variable is a primitive type, use type(x) is int so only subclasses show up as normal instances.
  • A setting to treat all values, be they "primitives" or not, as objects which can be inspected
  • A special cased command, function, or similar in the Debug Console to inspect a "primitive" as if it was a normal instance

Metadata

Metadata

Assignees

Labels

needs reproIssue has not been reproduced yet

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions