summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2023-11-18 04:58:13 (GMT)
committerGitHub <noreply@github.com>2023-11-18 04:58:13 (GMT)
commiteb3c94ea669561a0dfacaca715d4b2723bb2c6f4 (patch)
tree241fe49c2c0ae402ed709674e63c16ad0ec24f8e /Python/bytecodes.c
parent43b1c33204d125e256f7a0c3086ba547b71a105e (diff)
downloadcpython-eb3c94ea669561a0dfacaca715d4b2723bb2c6f4.zip
cpython-eb3c94ea669561a0dfacaca715d4b2723bb2c6f4.tar.gz
cpython-eb3c94ea669561a0dfacaca715d4b2723bb2c6f4.tar.bz2
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`
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r--Python/bytecodes.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index bd81dc1..da98630 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -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);