diff options
author | Amit Lavon <amitlavon1.spam@gmail.com> | 2025-03-30 23:07:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-30 23:07:25 (GMT) |
commit | 685fd74f81e673dc0430120f50009636b0e437a5 (patch) | |
tree | a415606ec816fdc47d597231184e3880309a56c5 /Python/bytecodes.c | |
parent | 39fa19a4ccb4c75d2421187e5b8d83c73b48ca4d (diff) | |
download | cpython-685fd74f81e673dc0430120f50009636b0e437a5.zip cpython-685fd74f81e673dc0430120f50009636b0e437a5.tar.gz cpython-685fd74f81e673dc0430120f50009636b0e437a5.tar.bz2 |
GH-131798: Remove type checks for _TO_BOOL_STR (GH-131816)
Diffstat (limited to 'Python/bytecodes.c')
-rw-r--r-- | Python/bytecodes.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c index 6336714..2d18f65 100644 --- a/Python/bytecodes.c +++ b/Python/bytecodes.c @@ -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; |