From 4d941d3fd11d2a669f6e895e0572de30cc0257a7 Mon Sep 17 00:00:00 2001 From: sobolevn Date: Mon, 17 Feb 2025 11:21:47 +0300 Subject: [PATCH] [3.13] gh-129805: Fix `bytes` annotation in `Tools/jit` (GH-129806) (#130216) (cherry picked from commit 422f8e9e02e68d45aee3846751a003a70fca13b6) --- Tools/jit/_targets.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Tools/jit/_targets.py b/Tools/jit/_targets.py index 73d10a128756..cebfad5a7467 100644 --- a/Tools/jit/_targets.py +++ b/Tools/jit/_targets.py @@ -102,7 +102,7 @@ class _Target(typing.Generic[_S, _R]): 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)) @@ -275,7 +275,10 @@ class _COFF( 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 { @@ -366,7 +369,10 @@ class _ELF( }, 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: @@ -442,7 +448,10 @@ class _MachO( 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: -- 2.47.3