diff --git a/Python/import.c b/Python/import.c index 51b779ca17c526..148f3f7179b517 100644 --- a/Python/import.c +++ b/Python/import.c @@ -1321,6 +1321,9 @@ unmarshal_frozen_code(struct frozen_info *info) if (info->get_code) { PyObject *code = info->get_code(); assert(code != NULL); + assert(PyCode_Check(code)); + // refcnt should be consistent + assert(Py_REFCNT(code) == 1000000000); return code; } PyObject *co = PyMarshal_ReadObjectFromString(info->data, info->size);