Skip to content

Parsing binary includes is broken #24

@fraove

Description

@fraove

Parsing a dts containing a binary include (/incbin/) gives me the following exception using python 3.7 and pyFDT 0.3.3:

Traceback (most recent call last):
  File "./test.py", line 9, in <module>
    tree = fdt.parse_dts(dts)
  File "<...>/python3.7/site-packages/fdt/__init__.py", line 505, in parse_dts
    prop_obj = PropIncBin(prop_name, prop_data, os.path.split(file_path)[1])
  File "<...>/python3.7/site-packages/fdt/items.py", line 469, in __init__
    super().__init__(name, data)
  File "<...>/site-packages/fdt/items.py", line 378, in __init__
    self.data = bytearray(args)
TypeError: 'bytes' object cannot be interpreted as an integer

Code to reproduce:

import fdt

dts = """/dts-v1/;

/ {
  data = /incbin/("data.bin");
};
"""

tree = fdt.parse_dts(dts)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions