Skip to content

Allow patching of lists #82

@gatecat

Description

@gatecat

Consider trying to patch the exception map, for example to test chipsalliance/fpga-interchange-schema#42. Aside from the StringIdx issue in #81, patching something that is a list rather than a struct fails even earlier.

exceptions.yaml:

 - primName: FOO
   macroName: BAR

run

python -mfpga_interchange.patch  --schema_dir ~/fpga-interchange-schema/interchange --patch_path exceptionMap  --schema device --patch_format yaml LIFCL-17.device exceptions.yaml LIFCL-17-patched.device

fails with:

Traceback (most recent call last):
  File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/home/david/python-fpga-interchange/fpga_interchange/patch.py", line 72, in <module>
    main()
  File "/home/david/python-fpga-interchange/fpga_interchange/patch.py", line 65, in main
    patch_capnp(message, patch_path, args.patch_format, f)
  File "/home/david/python-fpga-interchange/fpga_interchange/patch.py", line 30, in patch_capnp
    message_to_populate = message_to_populate.init(patch_path[-1])
  File "capnp/lib/capnp.pyx", line 1272, in capnp.lib.capnp._DynamicStructBuilder.init
  File "capnp/lib/capnp.pyx", line 1288, in capnp.lib.capnp._DynamicStructBuilder.init
capnp.lib.capnp.KjException: capnp/dynamic.c++:693: failed: init() without a size is only valid for struct and object fields.
stack: 7f32523e6be1 7f3252734173 7f32526aca3b 7f325321a252 7f325320071c 7f32531fc461 7f3253208269 7f32531f77b6 7f3253208269 7f32531f77b6 7f32531f628c 7f32531f5c50 7f32532b7b12 7f32532beedc 7f3253208c40 7f32531f77b6 7f32531f628c 7f325320840d 7f32531f77b6 7f32531f628c 7f325320840d 7f32532e2f67 7f32532d9a91 7f32532aaba8 7f3252f2d151 55bda411d04d

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions