[3.11] gh-93382: Cache result of PyCode_GetCode in codeobject (GH-93383) (#93493)

Co-authored-by: Kumar Aditya <59607654+kumaraditya303@users.noreply.github.com>
Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
This commit is contained in:
Ken Jin 2022-06-24 00:24:49 +08:00 committed by GitHub
parent 96a76141d5
commit 852b4d4bcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 543 additions and 528 deletions

View file

@ -279,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(f"._co_code = NULL,")
self.write("._co_linearray = NULL,")
self.write(f".co_code_adaptive = {co_code_adaptive},")
name_as_code = f"(PyCodeObject *)&{name}"