Skip to content

Commit ab263fe

Browse files
committed
Correct res type and change f var to empty
1 parent e23b84a commit ab263fe

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
@@ -1505,19 +1505,19 @@ def f(n):
15051505
for i in range(n):
15061506
dummy = "aaa"
15071507
# Hopefully the optimizer can't guess what the value is.
1508-
# f is always "", but we can only prove that it's a string:
1509-
f = dummy[:0]
1508+
# empty is always "", but we can only prove that it's a string:
1509+
empty = dummy[:0]
15101510
trace.append("A")
1511-
if not f: # Kept.
1511+
if not empty: # Kept.
15121512
trace.append("B")
1513-
if not f: # Removed!
1513+
if not empty: # Removed!
15141514
trace.append("C")
15151515
trace.append("D")
1516-
if f: # Removed!
1516+
if empty: # Removed!
15171517
trace.append("X")
15181518
trace.append("E")
15191519
trace.append("F")
1520-
if f: # Removed!
1520+
if empty: # Removed!
15211521
trace.append("X")
15221522
trace.append("G")
15231523
return trace

Python/optimizer_bytecodes.c

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

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)