summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
authorAmit Lavon <amitlavon1.spam@gmail.com>2025-03-30 23:07:25 (GMT)
committerGitHub <noreply@github.com>2025-03-30 23:07:25 (GMT)
commit685fd74f81e673dc0430120f50009636b0e437a5 (patch)
treea415606ec816fdc47d597231184e3880309a56c5 /Python/bytecodes.c
parent39fa19a4ccb4c75d2421187e5b8d83c73b48ca4d (diff)
downloadcpython-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.c9
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;