Fix for loading msvcrt in ctypes on python <2.6. Provided by Cristoph Gohlke

This commit is contained in:
Jorgen Stenarson
2011-07-07 23:55:20 +02:00
parent 6ead15b3d6
commit d5e23948e7
+4 -2
View File
@@ -599,8 +599,10 @@ class Console(object):
for func in funcs:
setattr(Console, func, getattr(windll.kernel32, func))
msvcrt = cdll.LoadLibrary(ctypes.util.find_msvcrt())
if sys.version_info[:2] < (2, 6):
msvcrt = cdll.msvcrt
else:
msvcrt = cdll.LoadLibrary(ctypes.util.find_msvcrt())
_strncpy = msvcrt.strncpy
_strncpy.restype = c_char_p
_strncpy.argtypes = [c_char_p, c_char_p, c_size_t]