Skip to content

[Python] Fix FlexBuffers typed vector float conversion#9181

Open
winklemad wants to merge 1 commit into
google:masterfrom
winklemad:fix-python-flexbuffers-as-float
Open

[Python] Fix FlexBuffers typed vector float conversion#9181
winklemad wants to merge 1 commit into
google:masterfrom
winklemad:fix-python-flexbuffers-as-float

Conversation

@winklemad

Copy link
Copy Markdown

Summary

  • Fix Ref.AsFloat for typed and fixed typed vectors by treating their type checks as properties.
  • Use AsFixedTypedVector when reading fixed typed-vector length.
  • Add regression coverage through the public Builder, Finish, and GetRoot APIs.

Problem

IsTypedVector and IsFixedTypedVector are properties, but AsFloat called them as functions. Valid typed vectors therefore raised TypeError. The fixed-vector branch also referenced the nonexistent FixedTypedVector accessor.

Testing

  • PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=python python3 -m unittest tests.py_flexbuffers_test.DecoderTest.test_typed_vectors_as_float
  • PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=../python python3 py_flexbuffers_test.py
  • Both generated-code modes of py_test.py — 127 tests passed each.
  • git diff --check

The wrapper suites tests/PythonTest.sh and tests/TestAll.sh, which require CMake and a built flatc for their Python stage, were not run locally. The relevant Python runtime suites were run directly.

Treat typed-vector predicates as properties when converting references to float, and use the fixed typed-vector accessor for fixed vectors. Add coverage through the public builder and parser APIs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant