-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Closed as not planned
Closed as not planned
Copy link
Labels
Description
Found in Version: flatc version 24.12.23
Steps to Reproduce:
- Build the following
.fbs
files:
inc.fbs
:
table Foo {
bar:int;
baz:float;
}
base.fbs
:
include "inc.fbs";
table Message {
payload:Foo;
}
root_type Message;
- Run
flatc --python --gen-onefile --gen-object-api -I ./ inc.fbs base.fbs
- Note that
--gen-object-api
isn't the broken flag -import
errors can still be seen without it, it's just useful for demonstration purposes
- Deserialize a populated
MessageT
object:
from base_generated import MessageT
from inc_generated import FooT
import flatbuffers
payload = FooT()
payload.bar = 42
payload.baz = 12.3
msg = MessageT()
msg.payload = payload
builder = flatbuffers.Builder(0)
builder.Finish(msg.Pack(builder))
MessageT().InitFromPackedBuf(builder.Output())
Expected Behavior
Deserializing a MessageT
object is supported
Actual Behavior
Deserializing the MessageT
object throws a NameError
because Foo
is not defined (not imported from inc_generated.py
) in Message.Payload()
.