[Python-checkins] cpython (merge 3.3 -> default): (Merge 3.3) Issue #17223: the test is specific to 32-bit wchar_t type

victor.stinner python-checkins at python.org
Fri Mar 8 02:33:57 CET 2013


http://hg.python.org/cpython/rev/42970cbfc982
changeset:   82541:42970cbfc982
parent:      82539:9aafc005a611
parent:      82540:1fd165883a65
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Fri Mar 08 02:33:44 2013 +0100
summary:
  (Merge 3.3) Issue #17223: the test is specific to 32-bit wchar_t type

Skip the test on Windows.

files:
  Lib/test/test_array.py |  14 +++-----------
  1 files changed, 3 insertions(+), 11 deletions(-)


diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py
--- a/Lib/test/test_array.py
+++ b/Lib/test/test_array.py
@@ -24,15 +24,7 @@
 except struct.error:
     have_long_long = False
 
-try:
-    import ctypes
-    sizeof_wchar = ctypes.sizeof(ctypes.c_wchar)
-except ImportError:
-    import sys
-    if sys.platform == 'win32':
-        sizeof_wchar = 2
-    else:
-        sizeof_wchar = 4
+sizeof_wchar = array.array('u').itemsize
 
 
 class ArraySubclass(array.array):
@@ -1076,8 +1068,8 @@
             # U+FFFFFFFF is an invalid code point in Unicode 6.0
             invalid_str = b'\xff\xff\xff\xff'
         else:
-            # invalid UTF-16 surrogate pair
-            invalid_str = b'\xff\xdf\x61\x00'
+            # PyUnicode_FromUnicode() cannot fail with 16-bit wchar_t
+            self.skipTest("specific to 32-bit wchar_t")
         a = array.array('u', invalid_str)
         self.assertRaises(ValueError, a.tounicode)
         self.assertRaises(ValueError, str, a)

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list