Skip to content

Commit 22d14d3

Browse files
committed
revert new patch sorting
1 parent 5e4b6fb commit 22d14d3

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/patcherex2/patcherex.py

+9-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import logging
33

44
from .patches import *
5-
from .patches import __all__
5+
from .patches import __all__ as all_patches
66
from .targets import Target
77

88
logger = logging.getLogger(__name__)
@@ -64,10 +64,16 @@ def __init__(
6464
InsertFunctionPatch,
6565
ModifyFunctionPatch,
6666
)
67-
assert len(self.patch_order) == len(__all__)
67+
assert len(self.patch_order) == len(all_patches)
6868

6969
def apply_patches(self):
70-
self.patches.sort(key=lambda x: self.patch_order.index(type(x)))
70+
# TODO: sort patches properly
71+
# self.patches.sort(key=lambda x: self.patch_order.index(type(x)))
72+
self.patches.sort(
73+
key=lambda x: not isinstance(
74+
x, (ModifyDataPatch, InsertDataPatch, RemoveDataPatch)
75+
)
76+
)
7177
logger.debug(f"Applying patches: {self.patches}")
7278
for patch in self.patches:
7379
patch.apply(self)

0 commit comments

Comments
 (0)