Skip to content
This repository was archived by the owner on Dec 28, 2025. It is now read-only.

Commit dbf2cfc

Browse files
committed
Typing changes for backward compatibility
1 parent 30ba4cd commit dbf2cfc

File tree

6 files changed

+14
-14
lines changed

6 files changed

+14
-14
lines changed

bin/dyldex_all

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ def _main() -> None:
254254
loggingLevel = logging.DEBUG
255255

256256
# create a list of image paths
257-
imagePaths: list[str] = []
257+
imagePaths: List[str] = []
258258
with open(args.dyld_path, "rb") as f:
259259
dyldFileCtx = FileContext(f)
260260
dyldCtx = DyldContext(dyldFileCtx)
@@ -269,7 +269,7 @@ def _main() -> None:
269269

270270
with multiprocessing.Pool(initializer=_workerInitializer) as pool:
271271
# Create a job for each image
272-
jobs: list[tuple[str, multiprocessing.pool.AsyncResult]] = []
272+
jobs: List[Tuple[str, multiprocessing.pool.AsyncResult]] = []
273273
jobsComplete = 0
274274
for i, imagePath in enumerate(imagePaths):
275275
# The index should correspond with its index in the DSC
@@ -284,7 +284,7 @@ def _main() -> None:
284284
)
285285

286286
# Record potential logging output for each job
287-
jobOutputs: list[str] = []
287+
jobOutputs: List[str] = []
288288

289289
# wait for all jobs
290290
while len(jobs):

src/DyldExtractor/converter/linkedit_optimizer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import struct
2-
from typing import Union, Type
2+
from typing import Union, Type, Dict
33

44
from DyldExtractor.extraction_context import ExtractionContext
55

@@ -30,7 +30,7 @@ def __init__(self) -> None:
3030

3131
self.symbolsSize = 0
3232

33-
self._stringMap: dict[bytes, int] = {}
33+
self._stringMap: Dict[bytes, int] = {}
3434
self._stringLength = 0
3535

3636
# first string is \x00 historically
@@ -109,7 +109,7 @@ def __init__(self, extractionCtx: ExtractionContext) -> None:
109109

110110
# Maps the old symbol indexes in the shared symbol table
111111
# to the new indexes in the optimized index table.
112-
self.oldToNewSymbolIndexes: dict[int, int] = {}
112+
self.oldToNewSymbolIndexes: Dict[int, int] = {}
113113

114114
self.newWeakBindingInfoOffset = 0
115115
self.newLazyBindingInfoOffset = 0

src/DyldExtractor/converter/objc_fixer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def __init__(
9999
# All the instructions in the text section.
100100
# The instruction at index 0 corresponds to
101101
# the first instruction.
102-
self._textInstr: tuple[int, str, tuple[str]] = None
102+
self._textInstr: Tuple[int, str, Tuple[str]] = None
103103
pass
104104

105105
def run(self) -> None:
@@ -1156,7 +1156,7 @@ def _processMethodList(self, methodListAddr: int, noImp=False) -> int:
11561156

11571157
# fix relative pointers after we reserve a new address for the method list
11581158
# contains a list of tuples of field offsets and their target addresses
1159-
relativeFixups: list[tuple[int, int]] = []
1159+
relativeFixups: List[Tuple[int, int]] = []
11601160
for i in range(methodListDef.count):
11611161
methodAddr = (
11621162
methodListAddr

src/DyldExtractor/converter/stub_fixer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ def __init__(self, extractionCtx: ExtractionContext) -> None:
4848
self._logger = extractionCtx.logger
4949

5050
# Stores and address and the possible symbols at the address
51-
self._symbolCache: dict[int, list[bytes]] = {}
51+
self._symbolCache: Dict[int, List[bytes]] = {}
5252

5353
# create a map of image paths and their addresses
54-
self._images: dict[bytes, int] = {}
54+
self._images: Dict[bytes, int] = {}
5555
for image in self._dyldCtx.images:
5656
imagePath = self._dyldCtx.fileCtx.readString(image.pathFileOffset)
5757
self._images[imagePath] = image.address
@@ -94,7 +94,7 @@ def _enumerateExports(self) -> None:
9494

9595
# These exports sometimes change the name of an existing
9696
# export symbol. We have to process them last.
97-
reExports: list[dyld_trie.ExportInfo] = []
97+
reExports: List[dyld_trie.ExportInfo] = []
9898

9999
# get an initial list of dependencies
100100
if dylibs := self._machoCtx.getLoadCommand(DEP_LCS, multiple=True):

src/DyldExtractor/dyld/dyld_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def hasSubCaches(self) -> bool:
101101
else:
102102
return False
103103

104-
def addSubCaches(self, subCacheFileCtxs: list[FileContext]) -> None:
104+
def addSubCaches(self, subCacheFileCtxs: List[FileContext]) -> None:
105105
cacheClass = type(self)
106106
for fileCtx in subCacheFileCtxs:
107107
subCache = cacheClass(fileCtx)

tests/run_all_images_multiprocess.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def _workerInitializer():
174174
args = parser.parse_args(namespace=_DyldExtractorArgs)
175175

176176
# create a list of images
177-
images: list[str] = []
177+
images: List[str] = []
178178
with open(args.dyld_path, "rb") as f:
179179
dyldFileCtx = FileContext(f)
180180
dyldCtx = DyldContext(dyldFileCtx)
@@ -190,7 +190,7 @@ def _workerInitializer():
190190
summary = ""
191191
with mp.Pool(args.jobs, initializer=_workerInitializer) as pool:
192192
# create jobs for each image
193-
jobs: list[tuple[str, mp.pool.AsyncResult]] = []
193+
jobs: List[Tuple[str, mp.pool.AsyncResult]] = []
194194
for index, imageName in enumerate(images):
195195
jobs.append(
196196
(imageName, pool.apply_async(_imageRunner, (args.dyld_path, index)))

0 commit comments

Comments
 (0)