diff options
author | Mark Shannon <mark@hotpy.org> | 2022-06-14 10:09:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-14 10:09:30 (GMT) |
commit | 3cd1a5d3ec487e23e3d976e7dd235329f04cfc73 (patch) | |
tree | 53e270197be3ceec9e38277ec30a0338631a6727 /Tools | |
parent | 2bf74753c14e5360e04930b478703f4e2618f4a3 (diff) | |
download | cpython-3cd1a5d3ec487e23e3d976e7dd235329f04cfc73.zip cpython-3cd1a5d3ec487e23e3d976e7dd235329f04cfc73.tar.gz cpython-3cd1a5d3ec487e23e3d976e7dd235329f04cfc73.tar.bz2 |
GH-93516: Store offset of first traceable instruction in code object (GH-93769)
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/scripts/deepfreeze.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Tools/scripts/deepfreeze.py b/Tools/scripts/deepfreeze.py index ac20767..443fcf2 100644 --- a/Tools/scripts/deepfreeze.py +++ b/Tools/scripts/deepfreeze.py @@ -20,6 +20,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) @@ -267,6 +270,10 @@ class Printer: self.write(f".co_qualname = {co_qualname},") self.write(f".co_linetable = {co_linetable},") 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})") |