[ctypes-commit] ctypes/unittests test_unicode.py,1.2,1.3
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2004-10-12 19:23:47
|
Update of /cvsroot/ctypes/ctypes/unittests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14963 Modified Files: test_unicode.py Log Message: Use the wcslen function exported by the test extension module. Easier than to portably find the platform's libc in the unittests. Index: test_unicode.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/unittests/test_unicode.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** test_unicode.py 12 Oct 2004 19:05:08 -0000 1.2 --- test_unicode.py 12 Oct 2004 19:23:38 -0000 1.3 *************** *** 3,25 **** import ctypes ! def get_libc(): ! import os, sys ! if os.name == "nt": ! return ctypes.cdll.msvcrt ! elif os.name == "posix": ! if sys.platform == "darwin": ! return ctypes.cdll.LoadLibrary("/usr/lib/libc.dylib") ! elif sys.platform == "cygwin": ! return ctypes.cdll.LoadLibrary("/bin/cygwin1.dll") ! elif sys.platform == "sunos5": ! return ctypes.cdll.LoadLibrary("/lib/libc.so") ! else: ! try: ! return ctypes.cdll.LoadLibrary("/lib/libc.so.6") ! except OSError: ! pass ! return None ! libc = get_libc() ! wcslen = libc.wcslen wcslen.argtypes = [ctypes.c_wchar_p] --- 3,9 ---- import ctypes ! import _ctypes_test ! libc = ctypes.CDLL(_ctypes_test.__file__) ! wcslen = libc.my_wcslen wcslen.argtypes = [ctypes.c_wchar_p] |