mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
GH-98522: Add version number to code objects. (GH-98525)
* Add version number to code object for better versioning of functions. * Improves specialization for closures and list comprehensions.
This commit is contained in:
parent
3c5355496b
commit
fb713b2183
10 changed files with 23 additions and 4 deletions
|
@ -11,7 +11,6 @@
|
|||
#include "pycore_tuple.h" // _PyTuple_ITEMS()
|
||||
#include "clinic/codeobject.c.h"
|
||||
|
||||
|
||||
static void
|
||||
notify_code_watchers(PyCodeEvent event, PyCodeObject *co)
|
||||
{
|
||||
|
@ -398,7 +397,10 @@ init_code(PyCodeObject *co, struct _PyCodeConstructor *con)
|
|||
co->co_nplaincellvars = nplaincellvars;
|
||||
co->co_ncellvars = ncellvars;
|
||||
co->co_nfreevars = nfreevars;
|
||||
|
||||
co->co_version = _Py_next_func_version;
|
||||
if (_Py_next_func_version != 0) {
|
||||
_Py_next_func_version++;
|
||||
}
|
||||
/* not set */
|
||||
co->co_weakreflist = NULL;
|
||||
co->co_extra = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue