summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_winsound.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-06-28 06:27:35 (GMT)
committerGitHub <noreply@github.com>2017-06-28 06:27:35 (GMT)
commit0834905d9b61291b1fc5e05a1ffbc69de9c9379f (patch)
tree456e79426ec816ba7e0a0bef7e94a6f8423b2786 /Lib/test/test_winsound.py
parent413c0a92bcc92efe92849fe5e711163da453410b (diff)
downloadcpython-0834905d9b61291b1fc5e05a1ffbc69de9c9379f.zip
cpython-0834905d9b61291b1fc5e05a1ffbc69de9c9379f.tar.gz
cpython-0834905d9b61291b1fc5e05a1ffbc69de9c9379f.tar.bz2
[3.6] bpo-13617: Reject embedded null characters in wchar* strings. (GH-2302) (#2462)
Based on patch by Victor Stinner. Add private C API function _PyUnicode_AsUnicode() which is similar to PyUnicode_AsUnicode(), but checks for null characters.. (cherry picked from commit f7eae0adfcd4c50034281b2c69f461b43b68db84)
Diffstat (limited to 'Lib/test/test_winsound.py')
-rw-r--r--Lib/test/test_winsound.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/test/test_winsound.py b/Lib/test/test_winsound.py
index 179e069..21437ef 100644
--- a/Lib/test/test_winsound.py
+++ b/Lib/test/test_winsound.py
@@ -98,6 +98,8 @@ class PlaySoundTest(unittest.TestCase):
self.assertRaises(TypeError, winsound.PlaySound, "bad",
winsound.SND_MEMORY)
self.assertRaises(TypeError, winsound.PlaySound, 1, 0)
+ # embedded null character
+ self.assertRaises(ValueError, winsound.PlaySound, 'bad\0', 0)
def test_keyword_args(self):
safe_PlaySound(flags=winsound.SND_ALIAS, sound="SystemExit")