mirror of
https://github.com/python/cpython.git
synced 2025-10-06 15:11:58 +00:00
bpo-46476: Simplify and fix _PyStaticCode_Dealloc (GH-30965)
This commit is contained in:
parent
247480a21c
commit
26b0482393
3 changed files with 10 additions and 7 deletions
|
@ -1908,16 +1908,19 @@ _PyCode_ConstantKey(PyObject *op)
|
|||
}
|
||||
|
||||
void
|
||||
_PyStaticCode_Dealloc(PyCodeObject *co, _Py_CODEUNIT *firstinstr)
|
||||
_PyStaticCode_Dealloc(PyCodeObject *co)
|
||||
{
|
||||
PyMem_Free(co->co_quickened);
|
||||
co->co_quickened = NULL;
|
||||
if (co->co_quickened) {
|
||||
PyMem_Free(co->co_quickened);
|
||||
co->co_quickened = NULL;
|
||||
_Py_QuickenedCount--;
|
||||
}
|
||||
co->co_warmup = QUICKENING_INITIAL_WARMUP_VALUE;
|
||||
PyMem_Free(co->co_extra);
|
||||
co->co_extra = NULL;
|
||||
co->co_firstinstr = firstinstr;
|
||||
co->co_firstinstr = (_Py_CODEUNIT *)PyBytes_AS_STRING(co->co_code);
|
||||
if (co->co_weakreflist != NULL) {
|
||||
PyObject_ClearWeakRefs((PyObject *)co);
|
||||
co->co_weakreflist = NULL;
|
||||
}
|
||||
co->co_warmup = QUICKENING_INITIAL_WARMUP_VALUE;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue