Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 763edc1

Browse files
committed
(Merge 3.3) Issue python#17223: the test is specific to 32-bit wchar_t type
Skip the test on Windows.
2 parents 857b24b + 29c0034 commit 763edc1

1 file changed

Lines changed: 3 additions & 11 deletions

File tree

Lib/test/test_array.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,7 @@
2424
except struct.error:
2525
have_long_long = False
2626

27-
try:
28-
import ctypes
29-
sizeof_wchar = ctypes.sizeof(ctypes.c_wchar)
30-
except ImportError:
31-
import sys
32-
if sys.platform == 'win32':
33-
sizeof_wchar = 2
34-
else:
35-
sizeof_wchar = 4
27+
sizeof_wchar = array.array('u').itemsize
3628

3729

3830
class ArraySubclass(array.array):
@@ -1076,8 +1068,8 @@ def test_issue17223(self):
10761068
# U+FFFFFFFF is an invalid code point in Unicode 6.0
10771069
invalid_str = b'\xff\xff\xff\xff'
10781070
else:
1079-
# invalid UTF-16 surrogate pair
1080-
invalid_str = b'\xff\xdf\x61\x00'
1071+
# PyUnicode_FromUnicode() cannot fail with 16-bit wchar_t
1072+
self.skipTest("specific to 32-bit wchar_t")
10811073
a = array.array('u', invalid_str)
10821074
self.assertRaises(ValueError, a.tounicode)
10831075
self.assertRaises(ValueError, str, a)

0 commit comments

Comments
 (0)