Commit a5119351 authored by Benjamin Peterson's avatar Benjamin Peterson

compare with equality not identity (issue #16172)

Patch from Serhiy Storchaka.
parent 14fb44e1
...@@ -16,16 +16,12 @@ def has_sound(sound): ...@@ -16,16 +16,12 @@ def has_sound(sound):
try: try:
# Ask the mixer API for the number of devices it knows about. # Ask the mixer API for the number of devices it knows about.
# When there are no devices, PlaySound will fail. # When there are no devices, PlaySound will fail.
if ctypes.windll.winmm.mixerGetNumDevs() is 0: if ctypes.windll.winmm.mixerGetNumDevs() == 0:
return False return False
key = winreg.OpenKeyEx(winreg.HKEY_CURRENT_USER, key = winreg.OpenKeyEx(winreg.HKEY_CURRENT_USER,
"AppEvents\Schemes\Apps\.Default\{0}\.Default".format(sound)) "AppEvents\Schemes\Apps\.Default\{0}\.Default".format(sound))
value = winreg.EnumValue(key, 0)[1] return winreg.EnumValue(key, 0)[1] != ""
if value is not "":
return True
else:
return False
except WindowsError: except WindowsError:
return False return False
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment