summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2024-03-05 15:23:08 (GMT)
committerGitHub <noreply@github.com>2024-03-05 15:23:08 (GMT)
commit23db9c62272f7470aadf8f52fe3ebb42b5e5d380 (patch)
treed3794d721c4e97f691fa0c5bed595f219075f4b7 /Python/bytecodes.c
parent0c81ce13602b88fd59f23f701ed8dc377d74e76e (diff)
downloadcpython-23db9c62272f7470aadf8f52fe3ebb42b5e5d380.zip
cpython-23db9c62272f7470aadf8f52fe3ebb42b5e5d380.tar.gz
cpython-23db9c62272f7470aadf8f52fe3ebb42b5e5d380.tar.bz2
GH-115685: Split `_TO_BOOL_ALWAYS_TRUE` into micro-ops (GH-116352)
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r--Python/bytecodes.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 396a8f0..15794cb 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -382,15 +382,16 @@ dummy_func(
}
}
- inst(TO_BOOL_ALWAYS_TRUE, (unused/1, version/2, value -- res)) {
- // This one is a bit weird, because we expect *some* failures:
- assert(version);
- EXIT_IF(Py_TYPE(value)->tp_version_tag != version);
- STAT_INC(TO_BOOL, hit);
- DECREF_INPUTS();
+ op(_REPLACE_WITH_TRUE, (value -- res)) {
+ Py_DECREF(value);
res = Py_True;
}
+ macro(TO_BOOL_ALWAYS_TRUE) =
+ unused/1 +
+ _GUARD_TYPE_VERSION +
+ _REPLACE_WITH_TRUE;
+
inst(UNARY_INVERT, (value -- res)) {
res = PyNumber_Invert(value);
DECREF_INPUTS();