Skip to content

Commit 8b4acd1

Browse files
committed
Correct res type and change f var to empty
1 parent 7f2dbcf commit 8b4acd1

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Lib/test/test_capi/test_opt.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1443,19 +1443,19 @@ def f(n):
14431443
for i in range(n):
14441444
dummy = "aaa"
14451445
# Hopefully the optimizer can't guess what the value is.
1446-
# f is always "", but we can only prove that it's a string:
1447-
f = dummy[:0]
1446+
# empty is always "", but we can only prove that it's a string:
1447+
empty = dummy[:0]
14481448
trace.append("A")
1449-
if not f: # Kept.
1449+
if not empty: # Kept.
14501450
trace.append("B")
1451-
if not f: # Removed!
1451+
if not empty: # Removed!
14521452
trace.append("C")
14531453
trace.append("D")
1454-
if f: # Removed!
1454+
if empty: # Removed!
14551455
trace.append("X")
14561456
trace.append("E")
14571457
trace.append("F")
1458-
if f: # Removed!
1458+
if empty: # Removed!
14591459
trace.append("X")
14601460
trace.append("G")
14611461
return trace

Python/optimizer_bytecodes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ dummy_func(void) {
438438
// removed and the narrowed value to be invalid:
439439
if (next_opcode == _GUARD_IS_FALSE_POP) {
440440
sym_set_const(value, Py_GetConstant(Py_CONSTANT_EMPTY_STR));
441-
res = sym_new_type(ctx, &PyUnicode_Type);
441+
res = sym_new_type(ctx, &PyBool_Type);
442442
}
443443
}
444444
}

Python/optimizer_cases.c.h

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)