flatbuffers
flatbuffers copied to clipboard
The converted structure is lost with python.
version:
windows release flatc version 2.0.0
for Common.Tile.ids:
in the fbs's definition, "Common.Tile.ids" == "Common.Slice". All other programming languages can be found in "Common.Tile.ids" "Common.Slice". but Python can not, I just found out that “obj”, what it brings is a mistake. Only Python faced this mistake, and I have no way to use it with python now .
fbs:
namespace Common;
struct Slice {
index:uint32;
size:uint32;
}
struct Tile {
x:int32;
y:int32;
ids:Slice;
}
python: (flatc.exe -p **.fbs)
def Ids(self, obj):
obj.Init(self._tab.Bytes, self._tab.Pos + 8)
return obj
cpp
const Common::Slice &ids() const {
return ids_;
}
java
public Common.Slice ids() { return ids(new Common.Slice()); }
public Common.Slice ids(Common.Slice obj) { return obj.__assign(bb_pos + 8, bb); }
go
func (rcv *Tile) Ids(obj *Slice) *Slice {
if obj == nil {
obj = new(Slice)
}
obj.Init(rcv._tab.Bytes, rcv._tab.Pos+8)
return obj
}
What do you mean by "the converted structure is lost"?
Sorry, I may have a grammar problem using Google Translate.
in the fbs's definition, "Common.Tile.ids" == "Common.Slice". All other programming languages can be found in "Common.Tile.ids" "Common.Slice". but Python can not, I just found out that “obj”, what it brings is a mistake.
What do you mean by "the converted structure is lost"?
Are you trying to say that the obj name in the following generated code should be named slice?
def Ids(self, obj):
obj.Init(self._tab.Bytes, self._tab.Pos + 8)
return obj
Are you trying to say that the
objname in the following generated code should be namedslice?def Ids(self, obj): obj.Init(self._tab.Bytes, self._tab.Pos + 8) return obj
Yes, this should be Slice, theoretically.
This issue is stale because it has been open 6 months with no activity. Please comment or label not-stale, or this will be closed in 14 days.
This issue was automatically closed due to no activity for 6 months plus the 14 day notice period.