fix if not xxx: stmt

This commit is contained in:
Lyon 2023-07-21 03:03:47 +08:00
parent 0249f2bf75
commit e41c5f2594
3 changed files with 15 additions and 1 deletions

View File

@ -73,8 +73,14 @@ def compare_strings(s1, s2):
else:
return False
def is_string_not_empty(s):
if not s:
return False
else:
return True
assert compare_strings('abc', 'abc') == True
assert compare_strings('abc', 'def') == False
assert is_string_not_empty('abc') == True
print("PASS")

View File

@ -73,8 +73,14 @@ def compare_strings(s1, s2):
else:
return False
def is_string_not_empty(s):
if not s:
return False
else:
return True
assert compare_strings('abc', 'abc') == True
assert compare_strings('abc', 'def') == False
assert is_string_not_empty('abc') == True
print("PASS")

View File

@ -3010,7 +3010,9 @@ static Arg* VM_instruction_handler_OPT(PikaObj* self,
}
if (data[0] == ' ' && data[1] == 'n' && data[2] == 'o' && data[3] == 't' &&
data[4] == ' ' && data[5] == 0) {
op.res = arg_setBool(op.res, "", !op.i2);
pika_bool bTrue = pika_false;
_transeBool(op.a2, &bTrue);
op.res = arg_setBool(op.res, "", !bTrue);
goto __exit;
}
pika_platform_printf("Error: unknown operator '%s'\n", data);