mirror of
https://github.com/python/cpython.git
synced 2025-08-25 19:24:42 +00:00
GH-131798: Remove type checks for _TO_BOOL_STR (GH-131816)
This commit is contained in:
parent
39fa19a4cc
commit
685fd74f81
10 changed files with 185 additions and 125 deletions
|
@ -512,10 +512,14 @@ dummy_func(
|
|||
res = PyStackRef_False;
|
||||
}
|
||||
|
||||
inst(TO_BOOL_STR, (unused/1, unused/2, value -- res)) {
|
||||
op(_GUARD_TOS_UNICODE, (value -- value)) {
|
||||
PyObject *value_o = PyStackRef_AsPyObjectBorrow(value);
|
||||
EXIT_IF(!PyUnicode_CheckExact(value_o));
|
||||
}
|
||||
|
||||
op(_TO_BOOL_STR, (value -- res)) {
|
||||
STAT_INC(TO_BOOL, hit);
|
||||
PyObject *value_o = PyStackRef_AsPyObjectBorrow(value);
|
||||
if (value_o == &_Py_STR(empty)) {
|
||||
assert(_Py_IsImmortal(value_o));
|
||||
DEAD(value);
|
||||
|
@ -528,6 +532,9 @@ dummy_func(
|
|||
}
|
||||
}
|
||||
|
||||
macro(TO_BOOL_STR) =
|
||||
_GUARD_TOS_UNICODE + unused/1 + unused/2 + _TO_BOOL_STR;
|
||||
|
||||
op(_REPLACE_WITH_TRUE, (value -- res)) {
|
||||
PyStackRef_CLOSE(value);
|
||||
res = PyStackRef_True;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue