Skip to content

Commit ed0cf84

Browse files
ani-sinhaliuw
authored andcommitted
vmbus_testing: fix wrong python syntax for integer value comparison
It is incorrect in python to compare integer values using the "is" keyword. The "is" keyword in python is used to compare references to two objects, not their values. Newer version of python3 (version 3.8) throws a warning when such incorrect comparison is made. For value comparison, "==" should be used. Fix this in the code and suppress the following warning: /usr/sbin/vmbus_testing:167: SyntaxWarning: "is" with a literal. Did you mean "=="? Signed-off-by: Ani Sinha <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Wei Liu <[email protected]>
1 parent 060f2b9 commit ed0cf84

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/hv/vmbus_testing

+2-2
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def recursive_file_lookup(path, file_map):
164164
def get_all_devices_test_status(file_map):
165165

166166
for device in file_map:
167-
if (get_test_state(locate_state(device, file_map)) is 1):
167+
if (get_test_state(locate_state(device, file_map)) == 1):
168168
print("Testing = ON for: {}"
169169
.format(device.split("/")[5]))
170170
else:
@@ -203,7 +203,7 @@ def write_test_files(path, value):
203203
def set_test_state(state_path, state_value, quiet):
204204

205205
write_test_files(state_path, state_value)
206-
if (get_test_state(state_path) is 1):
206+
if (get_test_state(state_path) == 1):
207207
if (not quiet):
208208
print("Testing = ON for device: {}"
209209
.format(state_path.split("/")[5]))

0 commit comments

Comments
 (0)