[3.11] GH-93516: Backport GH-93769: Speedup line number checks when tracing (GH-94127)

Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
This commit is contained in:
Mark Shannon 2022-06-22 16:32:02 +01:00 committed by GitHub
parent 8c2af49071
commit 3ece6e6feb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 409 additions and 298 deletions

View file

@ -262,6 +262,7 @@ class Printer:
self.write(f".co_exceptiontable = {co_exceptiontable},")
self.field(code, "co_flags")
self.write(".co_warmup = QUICKENING_INITIAL_WARMUP_VALUE,")
self.write("._co_linearray_entry_size = 0,")
self.field(code, "co_argcount")
self.field(code, "co_posonlyargcount")
self.field(code, "co_kwonlyargcount")
@ -278,6 +279,7 @@ class Printer:
self.write(f".co_name = {co_name},")
self.write(f".co_qualname = {co_qualname},")
self.write(f".co_linetable = {co_linetable},")
self.write("._co_linearray = NULL,")
self.write(f".co_code_adaptive = {co_code_adaptive},")
name_as_code = f"(PyCodeObject *)&{name}"
self.deallocs.append(f"_PyStaticCode_Dealloc({name_as_code});")