Skip to content

fix(python): make fixed array metadata methods static - #9188

Open
Pybsama wants to merge 1 commit into
google:masterfrom
Pybsama:codex/fix-python-array-static-methods
Open

fix(python): make fixed array metadata methods static#9188
Pybsama wants to merge 1 commit into
google:masterfrom
Pybsama:codex/fix-python-array-static-methods

Conversation

@Pybsama

@Pybsama Pybsama commented Jul 29, 2026

Copy link
Copy Markdown

Summary

  • generate fixed-array Length and IsNone accessors as parameterless static methods
  • keep dynamic-vector accessors as instance methods
  • regenerate Python runtime outputs and stubs, with regression coverage for both class and instance calls

Root cause

Fixed-length array metadata depends only on schema constants, but the Python generator emitted these accessors with self in both .py and .pyi output.

Testing

  • ./tests/PythonTest.sh
  • cmake --build build --target flattests -j 4 && ./build/flattests
  • focused unittest for fixed-array class and instance calls
  • direct validation of all generated fixed-array accessors and an unchanged dynamic-vector failure mode
  • sh scripts/clang-format-git.sh
  • git diff --check

Fixes #9069

@github-actions github-actions Bot added python c++ codegen Involving generating code from schema labels Jul 29, 2026
@google-cla

google-cla Bot commented Jul 29, 2026

Copy link
Copy Markdown

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.

@Pybsama

Pybsama commented Jul 29, 2026

Copy link
Copy Markdown
Author

@googlebot rescan

@Pybsama
Pybsama marked this pull request as ready for review July 29, 2026 05:38
@Pybsama
Pybsama requested a review from dbaileychess as a code owner July 29, 2026 05:38
@Pybsama
Pybsama force-pushed the codex/fix-python-array-static-methods branch from 4b66e25 to f6213ec Compare August 28, 2026 20:18
@Pybsama

Pybsama commented Aug 28, 2026

Copy link
Copy Markdown
Author

Fresh rebase/validation follow-up (2026-08-29):

  • Rebased the existing single patch onto current master (5761d6e6); the stable patch-id is unchanged. The new PR head is f6213ec47c8d9a6ae64e5d0e0e960e2b0b1a6c27, ahead 1 / behind 0, with the same 8-file scope.
  • Fresh out-of-source build: flatc and flattests built successfully, and flattests reported ALL TESTS PASSED.
  • ./tests/PythonTest.sh passed both multi-file and one-file generation modes (128 Python + 60 flexbuffers tests in each mode, 376 executions total). A direct boundary check also passed 44 class/instance calls across all 11 generated fixed-array fields and confirmed that a dynamic vector Length accessor still requires an instance.
  • The six changed .py / .pyi artifacts compile, scripts/clang-format-git.sh made no changes, git diff --check is clean, and an independent review found 0 Critical / 0 Important / 0 Minor issues.

The fresh CI and OSS-Fuzz workflow runs currently show action_required with zero jobs, so no upstream language test has executed yet; they need maintainer approval for this external-fork head. The label, CLA, and check-changes checks succeeded, while the four zizmor fan-out jobs were skipped.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python gen for array within struct not set to staticmethod for length/isnone

1 participant