Property transfer ownership of schema from py to c++ upon register_schema()

This commit is contained in:
Thomas Krijnen
2023-04-10 22:01:53 +02:00
parent 352d6b5ef9
commit 8a4a42777f
2 changed files with 8 additions and 5 deletions
@@ -84,7 +84,7 @@ class LateBoundSchemaInstantiator:
for attr_name, decl_type, optional in attribute_definitions:
attributes.append(w.attribute(attr_name, decl_type, optional))
self.declarations[str(name)].set_attributes(attributes, is_derived)
self.cache.append(attributes)
self.cache.extend(attributes)
def inverse_attributes(self, name, inv_attrs):
attributes = []
@@ -100,6 +100,7 @@ class LateBoundSchemaInstantiator:
en.attributes()[attribute_entity_index],
)
)
self.cache.extend(attributes)
self.declarations[str(name)].set_inverse_attributes(attributes)
def entity_subtypes(self, name, tys):
@@ -110,6 +111,10 @@ class LateBoundSchemaInstantiator:
override_schema_name or self.schema_name, list(self.declarations.values()), None
)
def disown(self):
for elem in self.cache + list(self.declarations.values()):
elem.this.disown()
class EarlyBoundCodeWriter:
def __init__(self, schema_name):