[Python] '--python-no-type-prefix-suffix' and '--gen-object-api' are incompatible
- Dominant language
- C++
- Stars
- 26.5k
- Forks
- 3.7k
- PR merge metrics
- No merged PRs in 30d
Description
### Description
When using `--python-no-type-prefix-suffix` and `--gen-object-api` flags for python codegen, the `Pack` method of the object API is broken as it still calls the prefixed method.
While this looks fixable, maybe `--python-no-type-prefix-suffix` is not so good to use in general.
### Minimal example
schema
```fbs
table TableFoo {
field1 :uint8 ;
field2 :string ;
}
table TableBoo {
table1 :TableFoo ;
}
```
produces
```python
# ...
def Start(builder: flatbuffers.Builder): # `--python-no-type-prefix-suffix` flag?
builder.StartObject(1) # generates multiple conflicting Start() functions
def AddTable1(builder: flatbuffers.Builder, table1: int):
builder.PrependUOffsetTRelativeSlot(0, flatbuffers.number_types.UOffsetTFlags.py_type(table1), 0)
def End(builder: flatbuffers.Builder) -> int:
return builder.EndObject()
# ...
class TableBooT(object):
# ...
# TableBooT
def Pack(self, builder):
if self.table1 is not None:
table1 = self.table1.Pack(builder)
TableBooStart(builder) # <-- no good
if self.table1 is not None:
TableBooAddTable1(builder, table1) # <-- no good
tableBoo = TableBooEnd(builder) # <-- no good
return tableBoo
# ...
```
Contributor guide
Assessment
This issue has not been assessed yet.