Skip to content

fix: Added return value to non type-prefixed create vector function#8945

Merged
jtdavis777 merged 3 commits intogoogle:masterfrom
RCRalph:fix-python-generation
Mar 5, 2026
Merged

fix: Added return value to non type-prefixed create vector function#8945
jtdavis777 merged 3 commits intogoogle:masterfrom
RCRalph:fix-python-generation

Conversation

@RCRalph
Copy link
Contributor

@RCRalph RCRalph commented Feb 27, 2026

Fixes #8944.

Added return statement to generated non type-prefixed create vector function.

Given the following schema:

namespace Example;

table NestedTable {
  value:uint64;
}

table MyTable {
  values:[NestedTable];
}

root_type MyTable;

Previously the generated code for creating values vector looked like this:

def MyTableCreateValuesVector(builder: flatbuffers.Builder, data: Iterable[Any]) -> int:
    return builder.CreateVectorOfTables(data)

def CreateValuesVector(builder: flatbuffers.Builder, data: Iterable[Any]) -> int:
    MyTableCreateValuesVector(builder, data)

The second method is missing a return statement, which means that it always returns None instead of int.
After changes, the generated code looks like this:

def MyTableCreateValuesVector(builder: flatbuffers.Builder, data: Iterable[Any]) -> int:
    return builder.CreateVectorOfTables(data)

def CreateValuesVector(builder: flatbuffers.Builder, data: Iterable[Any]) -> int:
    return MyTableCreateValuesVector(builder, data)

@google-cla
Copy link

google-cla bot commented Feb 27, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@github-actions github-actions bot added python c++ codegen Involving generating code from schema labels Feb 27, 2026
@RCRalph RCRalph force-pushed the fix-python-generation branch from dfed5dd to d9db258 Compare February 27, 2026 14:08
@jtdavis777 jtdavis777 added the ready-for-merge This PR has been approved by a maintainer and is ready for merge by a code owner label Mar 5, 2026
@jtdavis777 jtdavis777 enabled auto-merge (squash) March 5, 2026 02:04
@jtdavis777 jtdavis777 merged commit 8d2c333 into google:master Mar 5, 2026
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ codegen Involving generating code from schema python ready-for-merge This PR has been approved by a maintainer and is ready for merge by a code owner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Python] Non type-prefixed create vector function missing a return statement

2 participants