mirror of
https://github.com/python/cpython.git
synced 2025-11-24 12:20:42 +00:00
GH-129805: Clean up some changes from GH-129806 (GH-133540)
This commit is contained in:
parent
fc3e22a06c
commit
55e29a6100
2 changed files with 5 additions and 18 deletions
|
|
@ -137,11 +137,7 @@ class Hole:
|
||||||
def __post_init__(self) -> None:
|
def __post_init__(self) -> None:
|
||||||
self.func = _PATCH_FUNCS[self.kind]
|
self.func = _PATCH_FUNCS[self.kind]
|
||||||
|
|
||||||
def fold(
|
def fold(self, other: typing.Self, body: bytearray) -> typing.Self | None:
|
||||||
self,
|
|
||||||
other: typing.Self,
|
|
||||||
body: bytes | bytearray,
|
|
||||||
) -> typing.Self | None:
|
|
||||||
"""Combine two holes into a single hole, if possible."""
|
"""Combine two holes into a single hole, if possible."""
|
||||||
instruction_a = int.from_bytes(
|
instruction_a = int.from_bytes(
|
||||||
body[self.offset : self.offset + 4], byteorder=sys.byteorder
|
body[self.offset : self.offset + 4], byteorder=sys.byteorder
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ class _Target(typing.Generic[_S, _R]):
|
||||||
raise NotImplementedError(type(self))
|
raise NotImplementedError(type(self))
|
||||||
|
|
||||||
def _handle_relocation(
|
def _handle_relocation(
|
||||||
self, base: int, relocation: _R, raw: bytes | bytearray
|
self, base: int, relocation: _R, raw: bytearray
|
||||||
) -> _stencils.Hole:
|
) -> _stencils.Hole:
|
||||||
raise NotImplementedError(type(self))
|
raise NotImplementedError(type(self))
|
||||||
|
|
||||||
|
|
@ -297,10 +297,7 @@ class _COFF(
|
||||||
return _stencils.symbol_to_value(name)
|
return _stencils.symbol_to_value(name)
|
||||||
|
|
||||||
def _handle_relocation(
|
def _handle_relocation(
|
||||||
self,
|
self, base: int, relocation: _schema.COFFRelocation, raw: bytearray
|
||||||
base: int,
|
|
||||||
relocation: _schema.COFFRelocation,
|
|
||||||
raw: bytes | bytearray,
|
|
||||||
) -> _stencils.Hole:
|
) -> _stencils.Hole:
|
||||||
match relocation:
|
match relocation:
|
||||||
case {
|
case {
|
||||||
|
|
@ -410,10 +407,7 @@ class _ELF(
|
||||||
}, section_type
|
}, section_type
|
||||||
|
|
||||||
def _handle_relocation(
|
def _handle_relocation(
|
||||||
self,
|
self, base: int, relocation: _schema.ELFRelocation, raw: bytearray
|
||||||
base: int,
|
|
||||||
relocation: _schema.ELFRelocation,
|
|
||||||
raw: bytes | bytearray,
|
|
||||||
) -> _stencils.Hole:
|
) -> _stencils.Hole:
|
||||||
symbol: str | None
|
symbol: str | None
|
||||||
match relocation:
|
match relocation:
|
||||||
|
|
@ -492,10 +486,7 @@ class _MachO(
|
||||||
stencil.holes.append(hole)
|
stencil.holes.append(hole)
|
||||||
|
|
||||||
def _handle_relocation(
|
def _handle_relocation(
|
||||||
self,
|
self, base: int, relocation: _schema.MachORelocation, raw: bytearray
|
||||||
base: int,
|
|
||||||
relocation: _schema.MachORelocation,
|
|
||||||
raw: bytes | bytearray,
|
|
||||||
) -> _stencils.Hole:
|
) -> _stencils.Hole:
|
||||||
symbol: str | None
|
symbol: str | None
|
||||||
match relocation:
|
match relocation:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue