Calls to nested functions and comprehensions specialize poorly, if at all, because each individual function gets a different version, even though they are essentially the same.
Nested functions can have different defaults, or annotations. However we do not care what either of those are when testing the version. Comprehension functions don't have defaults or annotations.
We just care that the parameters are unchanged and that the number of defaults hasn't changed.
By giving each code object a globally unique id, we can copy that id into the function's version number when the function is created in byteode. All functions with the same code object and number of defaults would have the same version number.
Calls to nested functions and comprehensions specialize poorly, if at all, because each individual function gets a different version, even though they are essentially the same.
Nested functions can have different defaults, or annotations. However we do not care what either of those are when testing the version. Comprehension functions don't have defaults or annotations.
We just care that the parameters are unchanged and that the number of defaults hasn't changed.
By giving each code object a globally unique id, we can copy that id into the function's version number when the function is created in byteode. All functions with the same code object and number of defaults would have the same version number.