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/optimizer_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/optimizer_bytecodes.c')
-rw-r--r-- | Python/optimizer_bytecodes.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Python/optimizer_bytecodes.c b/Python/optimizer_bytecodes.c index 2ccfd0a..8d9e94a 100644 --- a/Python/optimizer_bytecodes.c +++ b/Python/optimizer_bytecodes.c @@ -414,10 +414,16 @@ dummy_func(void) { } } + op(_GUARD_TOS_UNICODE, (value -- value)) { + if (sym_matches_type(value, &PyUnicode_Type)) { + REPLACE_OP(this_instr, _NOP, 0, 0); + } + sym_set_type(value, &PyUnicode_Type); + } + op(_TO_BOOL_STR, (value -- res)) { if (!optimize_to_bool(this_instr, ctx, value, &res)) { res = sym_new_truthiness(ctx, value, true); - sym_set_type(value, &PyUnicode_Type); } } |