google/flatbuffers

[Python] Object API has the wrong name

Opened this issue · 0 comments

Here's a simple schema:

$ cat test.fbs 
namespace abc;
file_extension "abc";

struct ABCWord {
    w: [uint32:4];
}

table Root {
    words: [ABCWord];
}

root_type Root;

I compile it with the latest version of flatc like this:

$ flatc --version
flatc version 24.3.25

$ flatc --gen-object-api --python test.fbs

In the resulting file abc/ABCWord.py, the function is defined like this:

def CreateABCWord(builder, w):
    builder.Prep(4, 16)
    for _idx0 in range(4 , 0, -1):
        builder.PrependUint32(w[_idx0-1])
    return builder.Offset()

However, the object API calls the above function like this:

class ABCWordT(object):
    # ABCWordT
    def Pack(self, builder):
        return CreateAbcword(builder, self.w)

As we can see, the ABCWordT.Pack() method should call the function CreateABCWord(), not CreateAbcword().