mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
GH-115687: Most comparisons create Booleans, so propagate that information (GH-116360)
Most comparisons create booleans
This commit is contained in:
parent
2b379968e5
commit
33c0aa3bb9
2 changed files with 68 additions and 16 deletions
|
@ -351,6 +351,35 @@ dummy_func(void) {
|
|||
}
|
||||
}
|
||||
|
||||
op(_COMPARE_OP, (left, right -- res)) {
|
||||
if (oparg & 16) {
|
||||
OUT_OF_SPACE_IF_NULL(res = sym_new_type(ctx, &PyBool_Type));
|
||||
}
|
||||
else {
|
||||
OUT_OF_SPACE_IF_NULL(res = _Py_uop_sym_new_not_null(ctx));
|
||||
}
|
||||
}
|
||||
|
||||
op(_COMPARE_OP_INT, (left, right -- res)) {
|
||||
OUT_OF_SPACE_IF_NULL(res = sym_new_type(ctx, &PyBool_Type));
|
||||
}
|
||||
|
||||
op(_COMPARE_OP_FLOAT, (left, right -- res)) {
|
||||
OUT_OF_SPACE_IF_NULL(res = sym_new_type(ctx, &PyBool_Type));
|
||||
}
|
||||
|
||||
op(_COMPARE_OP_STR, (left, right -- res)) {
|
||||
OUT_OF_SPACE_IF_NULL(res = sym_new_type(ctx, &PyBool_Type));
|
||||
}
|
||||
|
||||
op(_IS_OP, (left, right -- res)) {
|
||||
OUT_OF_SPACE_IF_NULL(res = sym_new_type(ctx, &PyBool_Type));
|
||||
}
|
||||
|
||||
op(_CONTAINS_OP, (left, right -- res)) {
|
||||
OUT_OF_SPACE_IF_NULL(res = sym_new_type(ctx, &PyBool_Type));
|
||||
}
|
||||
|
||||
op(_LOAD_CONST, (-- value)) {
|
||||
// There should be no LOAD_CONST. It should be all
|
||||
// replaced by peephole_opt.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue