Maybe we could specialize the heck out of this and not bother with a function object? In the end we want to execute the code, the function object is just a convenient way to bundle defaults, free variables (cells) and globals. But co_annotation has no arguments or defaults, and is only called once. It does need to have access to the globals of the definition site (the call site may be in another module) and sometimes there are cells (not sure).

On Thu, Aug 12, 2021 at 1:14 AM Inada Naoki <songofacandy@gmail.com> wrote:
Lazy loading code object solves only a half of the problem.
I am worrying about function objects for annotation too.

Function objects are heavier than code objects. And they are GC-tracked objects.

I want to know how we can reduce the function objects created for
annotation in PEP 649, before deprecating PEP 563.

--
Inada Naoki  <songofacandy@gmail.com>


--
--Guido van Rossum (python.org/~guido)
Pronouns: he/him (why is my pronoun here?)