mirror of
https://github.com/lief-project/LIEF
synced 2026-06-08 15:30:44 +00:00
bb7faf3e72
The following Python code currently fails with Python 3.9:
import lief
elf = lief.ELF.Binary("test", lief.ELF.ELF_CLASS.CLASS32)
elf.header.identity = bytes.fromhex("7f454c46010101000000000000000000")
The reported error is:
TypeError: b'\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00' is not supported!
It is possible to use `.decode()` to convert the bytes to string, or to
use `list(...)` to convert them to a list of integers. Both these
solutions work, but they are not as elegant as directly using `bytes`.
Modify the `identity` setter to support bytes. As `Header::identity_t`
is directly an array of `uint8_t`, casting it from `py::bytes` is
straightforward.