GH-131798: Remove type checks for _TO_BOOL_STR (GH-131816)

This commit is contained in:
Amit Lavon 2025-03-30 16:07:25 -07:00 committed by GitHub
parent 39fa19a4cc
commit 685fd74f81
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 185 additions and 125 deletions

View file

@ -653,16 +653,23 @@
break;
}
case _TO_BOOL_STR: {
case _GUARD_TOS_UNICODE: {
_PyStackRef value;
_PyStackRef res;
value = stack_pointer[-1];
PyObject *value_o = PyStackRef_AsPyObjectBorrow(value);
if (!PyUnicode_CheckExact(value_o)) {
UOP_STAT_INC(uopcode, miss);
JUMP_TO_JUMP_TARGET();
}
break;
}
case _TO_BOOL_STR: {
_PyStackRef value;
_PyStackRef res;
value = stack_pointer[-1];
STAT_INC(TO_BOOL, hit);
PyObject *value_o = PyStackRef_AsPyObjectBorrow(value);
if (value_o == &_Py_STR(empty)) {
assert(_Py_IsImmortal(value_o));
res = PyStackRef_False;