Skip to content

Issue with subclasses, slots and mangled attributes #506

Description

@chriswyatt

Describe the bug
If two instances are used in a comparison, where:

  • one is a subclass of the other
  • Mangled attribute is used in __slots__
  • Both classes are specified as a group in ignore_type_in_groups

Then an unprocessed result is returned.

To Reproduce

from bson import ObjectId  # pymongo

class MyObjectId(ObjectId): pass

oid = 'deadbeef1234deadbeef1234'
o1 = ObjectId(oid)
o2 = MyObjectId(oid)
DeepDiff(o1, o2, ignore_type_in_groups[(ObjectId, MyObjectId)])

Expected behavior
An empty DeepDiff object is returned

OS, DeepDiff version and Python version (please complete the following information):

  • OS: Arch Linux ARM
  • Version 2024-11
  • Python Version 3.12.2
  • DeepDiff Version 8.0.1

Additional context
bson.ObjectId is imported from PyMongo 4.10.1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

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