def __post_init__(self) -> None:
self.func = _PATCH_FUNCS[self.kind]
- def fold(self, other: typing.Self, body: bytes) -> typing.Self | None:
+ def fold(
+ self,
+ other: typing.Self,
+ body: bytes | bytearray,
+ ) -> typing.Self | None:
"""Combine two holes into a single hole, if possible."""
instruction_a = int.from_bytes(
body[self.offset : self.offset + 4], byteorder=sys.byteorder
raise NotImplementedError(type(self))
def _handle_relocation(
- self, base: int, relocation: _R, raw: bytes
+ self, base: int, relocation: _R, raw: bytes | bytearray
) -> _stencils.Hole:
raise NotImplementedError(type(self))
return _stencils.symbol_to_value(name)
def _handle_relocation(
- self, base: int, relocation: _schema.COFFRelocation, raw: bytes
+ self,
+ base: int,
+ relocation: _schema.COFFRelocation,
+ raw: bytes | bytearray,
) -> _stencils.Hole:
match relocation:
case {
}, section_type
def _handle_relocation(
- self, base: int, relocation: _schema.ELFRelocation, raw: bytes
+ self,
+ base: int,
+ relocation: _schema.ELFRelocation,
+ raw: bytes | bytearray,
) -> _stencils.Hole:
symbol: str | None
match relocation:
stencil.holes.append(hole)
def _handle_relocation(
- self, base: int, relocation: _schema.MachORelocation, raw: bytes
+ self,
+ base: int,
+ relocation: _schema.MachORelocation,
+ raw: bytes | bytearray,
) -> _stencils.Hole:
symbol: str | None
match relocation: