The root cause is that GenericStruct.get_class_attributes yields values from a cls.__dict__ which is also being mutated when unpack is being called, which in turn will call _unpack_attribute that is using setattr, this is the mutation that is changing can change the dict size. The dict size depends on internal python implementation, since in the low level implementation it'll allocate upfront this bug isn't deterministic, but it can happen when internally the dict size changes due to a new insertion, which why it took so long to be surfaced and reported. Making a shallow copy should suffice to fix this problem since it's not unpacking recursively when iterating over it.
This is related to this issue: https://github.com/kytos-ng/of_core/issues/112
The root cause is that
GenericStruct.get_class_attributes
yields values from acls.__dict__
which is also being mutated when unpack is being called, which in turn will call _unpack_attribute that is usingsetattr
, this is the mutation that is changing can change the dict size. The dict size depends on internal python implementation, since in the low level implementation it'll allocate upfront this bug isn't deterministic, but it can happen when internally the dict size changes due to a new insertion, which why it took so long to be surfaced and reported. Making a shallow copy should suffice to fix this problem since it's not unpacking recursively when iterating over it.