]> granicus.if.org Git - python/commitdiff
compare with equality not identity (issue #16172)
authorBenjamin Peterson <benjamin@python.org>
Tue, 9 Oct 2012 15:14:59 +0000 (11:14 -0400)
committerBenjamin Peterson <benjamin@python.org>
Tue, 9 Oct 2012 15:14:59 +0000 (11:14 -0400)
Patch from Serhiy Storchaka.

Lib/test/test_winsound.py

index 34c3deaf7eb3c0c21c7d3a25f83b166c5e0b0f47..eb7f75f066adc3347fe57f818636141f6c2f9411 100644 (file)
@@ -16,16 +16,12 @@ def has_sound(sound):
     try:
         # Ask the mixer API for the number of devices it knows about.
         # When there are no devices, PlaySound will fail.
-        if ctypes.windll.winmm.mixerGetNumDevs() is 0:
+        if ctypes.windll.winmm.mixerGetNumDevs() == 0:
             return False
 
         key = winreg.OpenKeyEx(winreg.HKEY_CURRENT_USER,
                 "AppEvents\Schemes\Apps\.Default\{0}\.Default".format(sound))
-        value = winreg.EnumValue(key, 0)[1]
-        if value is not "":
-            return True
-        else:
-            return False
+        return winreg.EnumValue(key, 0)[1] != ""
     except WindowsError:
         return False