mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-95756: Lazily created cached co_* attrs (GH-97791)
This commit is contained in:
parent
f871e9a7bb
commit
b399115ef1
5 changed files with 82 additions and 14 deletions
|
@ -645,9 +645,12 @@ add_load_fast_null_checks(PyCodeObject *co)
|
|||
}
|
||||
i += _PyOpcode_Caches[_PyOpcode_Deopt[opcode]];
|
||||
}
|
||||
if (changed) {
|
||||
if (changed && co->_co_cached != NULL) {
|
||||
// invalidate cached co_code object
|
||||
Py_CLEAR(co->_co_code);
|
||||
Py_CLEAR(co->_co_cached->_co_code);
|
||||
Py_CLEAR(co->_co_cached->_co_cellvars);
|
||||
Py_CLEAR(co->_co_cached->_co_freevars);
|
||||
Py_CLEAR(co->_co_cached->_co_varnames);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue