Skip to content

schema objects don't retain a class hierarchy #144

@wllgrnt

Description

@wllgrnt

Repro:

from object_database import Schema
subclass_schema = Schema("test_subclassing")

@subclass_schema.define
class BaseClass:
    x = int

@subclass_schema.define
class DerivedClass(BaseClass):
    y = int

assert issubclass(DerivedClass, BaseClass)

This is due to __bases__ and __mro__ not being set properly when the object is created in the define method of schema.py. Options:

  1. Implement tp_base in the C
  2. Generate a new set_bases() method on the object t that is called during the initialisation process.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions