flatbuffers
flatbuffers copied to clipboard
[python] Missing class in generated code for unions
Below are three fbs files, two of which includes assets.fbs
which contains a union. Depending on compilation order, the generated Python code is missing a class.
assets.fbs
union Asset {}
game.fbs
include "assets.fbs";
table GameData {
asset: Asset;
}
root_type GameData;
player.fbs
include "assets.fbs";
Depending on the compilation order, you'll get either:
Asset.py (INCORRECT, player.fbs is compiled last)
def AssetCreator(unionType, table):
from flatbuffers.table import Table
if not isinstance(table, Table):
return None
return None
or
Asset.py (CORRECT, player.fbs is compiled first)
class Asset(object):
NONE = 0
def AssetCreator(unionType, table):
from flatbuffers.table import Table
if not isinstance(table, Table):
return None
return None
In other words, if player.fbs
is compiled last, an invalidAsset.py
without the Asset class is generated.
@rw may know
This issue is stale because it has been open 6 months with no activity. Please comment or this will be closed in 14 days.
This issue is stale because it has been open 6 months with no activity. Please comment or this will be closed in 14 days.
This issue is stale because it has been open 6 months with no activity. Please comment or this will be closed in 14 days.
This issue is stale because it has been open 6 months with no activity. Please comment or this will be closed in 14 days.
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 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.
Unable to add not-stale, so adding this comment. This bug is still around.
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.
Not stale (unable to add label) - bug still around