summaryrefslogtreecommitdiffstats
path: root/Python/bytecodes.c
diff options
context:
space:
mode:
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;