Skip to content

Commit

Permalink
vmbus_testing: fix wrong python syntax for integer value comparison
Browse files Browse the repository at this point in the history
[ Upstream commit ed0cf84 ]

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 <anisinha@redhat.com>
Link: https://lore.kernel.org/r/20230705134408.6302-1-anisinha@redhat.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
ani-sinha authored and gregkh committed Sep 13, 2023
1 parent 98f9337 commit 51edd73
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/hv/vmbus_testing
Expand Up @@ -164,7 +164,7 @@ def recursive_file_lookup(path, file_map):
def get_all_devices_test_status(file_map):

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

write_test_files(state_path, state_value)
if (get_test_state(state_path) is 1):
if (get_test_state(state_path) == 1):
if (not quiet):
print("Testing = ON for device: {}"
.format(state_path.split("/")[5]))
Expand Down

0 comments on commit 51edd73

Please sign in to comment.