Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

schema objects don't retain a class hierarchy #144

Open
wllgrnt opened this issue Jun 2, 2023 · 0 comments
Open

schema objects don't retain a class hierarchy #144

wllgrnt opened this issue Jun 2, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@wllgrnt
Copy link
Contributor

wllgrnt commented Jun 2, 2023

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.
@wllgrnt wllgrnt added the bug Something isn't working label Jun 2, 2023
@wllgrnt wllgrnt self-assigned this Jun 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant