summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-06-27 18:08:58 (GMT)
committerGitHub <noreply@github.com>2017-06-27 18:08:58 (GMT)
commit0edffa3073b551ffeca34952529e7b292f1bd350 (patch)
treedcbf750061bcbe9da3ae9401292185b44490bb4b /Lib
parent35d2ca2b94a6ff29e763ddb7727166f0592edfa2 (diff)
downloadcpython-0edffa3073b551ffeca34952529e7b292f1bd350.zip
cpython-0edffa3073b551ffeca34952529e7b292f1bd350.tar.gz
cpython-0edffa3073b551ffeca34952529e7b292f1bd350.tar.bz2
[3.6] bpo-30708: Check for null characters in PyUnicode_AsWideCharString(). (GH-2285) (#2443)
Raise a ValueError if the second argument is NULL and the wchar_t\* string contains null characters.. (cherry picked from commit e613e6add5f07ff6aad5802924596b631b707d2a)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/ctypes/test/test_slicing.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/ctypes/test/test_slicing.py b/Lib/ctypes/test/test_slicing.py
index 240dc0c..a3932f1 100644
--- a/Lib/ctypes/test/test_slicing.py
+++ b/Lib/ctypes/test/test_slicing.py
@@ -134,7 +134,7 @@ class SlicesTestCase(unittest.TestCase):
dll.my_wcsdup.restype = POINTER(c_wchar)
dll.my_wcsdup.argtypes = POINTER(c_wchar),
dll.my_free.restype = None
- res = dll.my_wcsdup(s)
+ res = dll.my_wcsdup(s[:-1])
self.assertEqual(res[:len(s)], s)
self.assertEqual(res[:len(s):], s)
self.assertEqual(res[len(s)-1:-1:-1], s[::-1])
@@ -153,7 +153,7 @@ class SlicesTestCase(unittest.TestCase):
dll.my_wcsdup.restype = POINTER(c_long)
else:
self.skipTest('Pointers to c_wchar are not supported')
- res = dll.my_wcsdup(s)
+ res = dll.my_wcsdup(s[:-1])
tmpl = list(range(ord("a"), ord("z")+1))
self.assertEqual(res[:len(s)-1], tmpl)
self.assertEqual(res[:len(s)-1:], tmpl)