summaryrefslogtreecommitdiffstats
path: root/Objects/frameobject.c
diff options
context:
space:
mode:
authorKen Jin <kenjin@python.org>2022-10-11 03:26:08 (GMT)
committerGitHub <noreply@github.com>2022-10-11 03:26:08 (GMT)
commitb399115ef18945f7526492225d72a512048ad20d (patch)
treea535c3b234b6eebddee356b9a4df25971f0b89b5 /Objects/frameobject.c
parentf871e9a7bb4eb823da481b99052636763ec8e710 (diff)
downloadcpython-b399115ef18945f7526492225d72a512048ad20d.zip
cpython-b399115ef18945f7526492225d72a512048ad20d.tar.gz
cpython-b399115ef18945f7526492225d72a512048ad20d.tar.bz2
gh-95756: Lazily created cached co_* attrs (GH-97791)
Diffstat (limited to 'Objects/frameobject.c')
-rw-r--r--Objects/frameobject.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Objects/frameobject.c b/Objects/frameobject.c
index 6a51a94..bd1608e 100644
--- a/Objects/frameobject.c
+++ b/Objects/frameobject.c
@@ -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);
}
}