summaryrefslogtreecommitdiffstats
path: root/Tools/scripts/deepfreeze.py
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/scripts/deepfreeze.py')
-rw-r--r--Tools/scripts/deepfreeze.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Tools/scripts/deepfreeze.py b/Tools/scripts/deepfreeze.py
index 5aca79a..5a64c1e 100644
--- a/Tools/scripts/deepfreeze.py
+++ b/Tools/scripts/deepfreeze.py
@@ -22,6 +22,9 @@ from generate_global_objects import get_identifiers_and_strings
verbose = False
identifiers, strings = get_identifiers_and_strings()
+# This must be kept in sync with opcode.py
+RESUME = 151
+
def isprintable(b: bytes) -> bool:
return all(0x20 <= c < 0x7f for c in b)
@@ -284,6 +287,10 @@ class Printer:
self.write(f"._co_code = NULL,")
self.write("._co_linearray = NULL,")
self.write(f".co_code_adaptive = {co_code_adaptive},")
+ for i, op in enumerate(code.co_code[::2]):
+ if op == RESUME:
+ self.write(f"._co_firsttraceable = {i},")
+ break
name_as_code = f"(PyCodeObject *)&{name}"
self.deallocs.append(f"_PyStaticCode_Dealloc({name_as_code});")
self.interns.append(f"_PyStaticCode_InternStrings({name_as_code})")