mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-110319: Assert type_version != 0 before using it (#112226)
- Ensure that `assert(type_version != 0);` always comes *before* using `type_version` Also: - In cases_generator, rename `-v` to from `--verbose` to `--viable`
This commit is contained in:
parent
43b1c33204
commit
eb3c94ea66
3 changed files with 6 additions and 6 deletions
|
@ -2026,8 +2026,8 @@ dummy_func(
|
|||
DEOPT_IF(tstate->interp->eval_frame);
|
||||
|
||||
PyTypeObject *cls = Py_TYPE(owner);
|
||||
DEOPT_IF(cls->tp_version_tag != type_version);
|
||||
assert(type_version != 0);
|
||||
DEOPT_IF(cls->tp_version_tag != type_version);
|
||||
assert(Py_IS_TYPE(fget, &PyFunction_Type));
|
||||
PyFunctionObject *f = (PyFunctionObject *)fget;
|
||||
assert(func_version != 0);
|
||||
|
@ -2049,8 +2049,8 @@ dummy_func(
|
|||
assert((oparg & 1) == 0);
|
||||
DEOPT_IF(tstate->interp->eval_frame);
|
||||
PyTypeObject *cls = Py_TYPE(owner);
|
||||
DEOPT_IF(cls->tp_version_tag != type_version);
|
||||
assert(type_version != 0);
|
||||
DEOPT_IF(cls->tp_version_tag != type_version);
|
||||
assert(Py_IS_TYPE(getattribute, &PyFunction_Type));
|
||||
PyFunctionObject *f = (PyFunctionObject *)getattribute;
|
||||
assert(func_version != 0);
|
||||
|
|
4
Python/generated_cases.c.h
generated
4
Python/generated_cases.c.h
generated
|
@ -2933,8 +2933,8 @@
|
|||
DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR);
|
||||
|
||||
PyTypeObject *cls = Py_TYPE(owner);
|
||||
DEOPT_IF(cls->tp_version_tag != type_version, LOAD_ATTR);
|
||||
assert(type_version != 0);
|
||||
DEOPT_IF(cls->tp_version_tag != type_version, LOAD_ATTR);
|
||||
assert(Py_IS_TYPE(fget, &PyFunction_Type));
|
||||
PyFunctionObject *f = (PyFunctionObject *)fget;
|
||||
assert(func_version != 0);
|
||||
|
@ -2964,8 +2964,8 @@
|
|||
assert((oparg & 1) == 0);
|
||||
DEOPT_IF(tstate->interp->eval_frame, LOAD_ATTR);
|
||||
PyTypeObject *cls = Py_TYPE(owner);
|
||||
DEOPT_IF(cls->tp_version_tag != type_version, LOAD_ATTR);
|
||||
assert(type_version != 0);
|
||||
DEOPT_IF(cls->tp_version_tag != type_version, LOAD_ATTR);
|
||||
assert(Py_IS_TYPE(getattribute, &PyFunction_Type));
|
||||
PyFunctionObject *f = (PyFunctionObject *)getattribute;
|
||||
assert(func_version != 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue