diff Lib/test/test_codecs.py @ 72683:da3bfa2e9daa

Fix text failures when ctypes is not available (followup to Victor's 85d11cf67aa8 and 7a50e549bd11)
author Antoine Pitrou <solipsis@pitrou.net>
date Wed, 05 Oct 2011 13:01:41 +0200
parents 85d11cf67aa8
children af0800b986b7
line wrap: on
line diff
--- a/Lib/test/test_codecs.py	Tue Oct 04 23:37:43 2011 +0200
+++ b/Lib/test/test_codecs.py	Wed Oct 05 13:01:41 2011 +0200
@@ -3,9 +3,14 @@
 import codecs
 import locale
 import sys, _testcapi, io
-import ctypes
 
-SIZEOF_WCHAR_T = ctypes.sizeof(ctypes.c_wchar)
+try:
+    import ctypes
+except ImportError:
+    ctypes = None
+    SIZEOF_WCHAR_T = -1
+else:
+    SIZEOF_WCHAR_T = ctypes.sizeof(ctypes.c_wchar)
 
 class Queue(object):
     """