mirror of
https://github.com/python/cpython.git
synced 2025-08-23 18:24:46 +00:00
GH-115685: Split _TO_BOOL_ALWAYS_TRUE
into micro-ops (GH-116352)
This commit is contained in:
parent
0c81ce1360
commit
23db9c6227
8 changed files with 50 additions and 44 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue