Skip to content

Commit a511935

Browse files
committed
compare with equality not identity (issue #16172)
Patch from Serhiy Storchaka.
1 parent 14fb44e commit a511935

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

Lib/test/test_winsound.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,12 @@ def has_sound(sound):
1616
try:
1717
# Ask the mixer API for the number of devices it knows about.
1818
# When there are no devices, PlaySound will fail.
19-
if ctypes.windll.winmm.mixerGetNumDevs() is 0:
19+
if ctypes.windll.winmm.mixerGetNumDevs() == 0:
2020
return False
2121

2222
key = winreg.OpenKeyEx(winreg.HKEY_CURRENT_USER,
2323
"AppEvents\Schemes\Apps\.Default\{0}\.Default".format(sound))
24-
value = winreg.EnumValue(key, 0)[1]
25-
if value is not "":
26-
return True
27-
else:
28-
return False
24+
return winreg.EnumValue(key, 0)[1] != ""
2925
except WindowsError:
3026
return False
3127

0 commit comments

Comments
 (0)