Revert Data fields to bytes and add get_data_as_view for zero-copy access (#390)

* get data field with view

* refine tc

* refine based on flake check

* run black again

* rebase upstream master

* add comment to tc

* refine raise exception
This commit is contained in:
Brian Xu
2026-01-16 16:40:22 +11:00
committed by GitHub
parent 9754258d46
commit 9237ba123a
4 changed files with 265 additions and 7 deletions

View File

@@ -41,9 +41,6 @@ def test_addressbook(all_types):
struct_builder.init("dataField", 5)
assert struct_builder._get("dataField") == b"\x00\x00\x00\x00\x00"
struct_builder._get("dataField")[1] = 0xFF
assert struct_builder._get("dataField") == b"\x00\xff\x00\x00\x00"
struct_builder.dataField = b"hello"
assert struct_builder._get("dataField") == b"hello"