Skip to content

Infinite iteration in _AddListFieldsMethod when serializing nested messages #9

@mrgonza78

Description

@mrgonza78
// issue.proto
syntax = "proto2";

message Qux {
  optional uint32 waldo = 1;
}

message Bar {
  optional Qux qux = 1;
}

message Foo {
  optional Bar bar = 1;
}
issue_pb = require('issue_pb')
foo = issue_pb.Foo()
foo.bar.qux.waldo = 1
foo:SerializeToString()

SerializeToString loops infinitely at _AddListFieldsMethod.

The problem seems to be that bar. _is_present_in_parent is false b/c bar.SetInParent is never called (may be?)

If I manually call bar.SetInParent, then it just works

issue_pb = require('issue_pb')
foo = issue_pb.Foo()
foo.bar.qux.waldo = 1
bar:SetInParent()
foo:SerializeToString() -- Now it works, I get the string

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions