Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python --gen-onefile option not respecting include directive #8543

Open
sethraymond opened this issue Feb 27, 2025 · 0 comments
Open

Python --gen-onefile option not respecting include directive #8543

sethraymond opened this issue Feb 27, 2025 · 0 comments

Comments

@sethraymond
Copy link

Found in Version: flatc version 24.12.23

Steps to Reproduce:

  1. 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;
  1. 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
  1. 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().

sethraymond added a commit to sethraymond/flatbuffers that referenced this issue Feb 27, 2025
With include_dependence_headers set to false, fbs files that include
from other fbs files would not properly deserialize.

Fixes google#8543
sethraymond added a commit to sethraymond/flatbuffers that referenced this issue Feb 27, 2025
With include_dependence_headers set to false, fbs files that include
from other fbs files would not properly deserialize.

Fixes google#8543
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant