1414from igraph_ctypes ._internal .functions import igraph_ecount , igraph_vcount
1515from igraph_ctypes ._internal .lib import (
1616 igraph_attribute_combination_query ,
17+ igraph_attribute_record_list_size ,
1718 igraph_error ,
1819 igraph_es_as_vector ,
1920 igraph_vector_resize ,
@@ -117,6 +118,9 @@ def init(self, graph, attr):
117118 assign_storage_to_graph (graph , DictAttributeStorage ())
118119 self ._indices = _VectorInt .create (0 )
119120
121+ if attr and igraph_attribute_record_list_size (attr ) != 0 :
122+ raise RuntimeError ("attribute initialization not implemented yet" )
123+
120124 def destroy (self , graph ) -> None :
121125 storage = get_storage_from_graph (graph )
122126 if storage :
@@ -148,12 +152,8 @@ def copy(
148152 assign_storage_to_graph (to , new_storage )
149153
150154 def add_vertices (self , graph , n : int , attr ) -> None :
151- # attr will only ever be NULL here so raise an error if it is not
152- if attr :
153- raise RuntimeError (
154- "add_vertices() attribute handler called with non-null attr; "
155- "this is most likely a bug"
156- ) # pragma: no cover
155+ if attr and igraph_attribute_record_list_size (attr ) != 0 :
156+ raise RuntimeError ("attribute initialization not implemented yet" )
157157
158158 # Extend the existing attribute containers
159159 get_storage_from_graph (graph ).add_vertices (graph , n )
@@ -172,12 +172,8 @@ def combine_vertices(self, graph, to, mapping, combinations):
172172 assert not _are_pointers_equal (graph , to )
173173
174174 def add_edges (self , graph , edges , attr ) -> None :
175- # attr will only ever be NULL here so raise an error if it is not
176- if attr :
177- raise RuntimeError (
178- "add_edges() attribute handler called with non-null attr; "
179- "this is most likely a bug"
180- ) # pragma: no cover
175+ if attr and igraph_attribute_record_list_size (attr ) != 0 :
176+ raise RuntimeError ("attribute initialization not implemented yet" )
181177
182178 # Extend the existing attribute containers
183179 edge_array = igraph_vector_int_t_to_numpy_array_view (edges ).reshape ((- 1 , 2 ))
0 commit comments