Patch #1318 by Amaury Forgeot d'Arc.
Updates to ctypes for python 3.0 to make the tests pass.
Notable changes are:
- return bytes instead of str8
- integers in range(256) are accepted as "one char string":
libc.strchr("abcdef", 98) is now valid.
- directly use the wide-char version of the win32 function LoadLibrary.
diff --git a/Lib/ctypes/__init__.py b/Lib/ctypes/__init__.py
index c413127..cc05e97 100644
--- a/Lib/ctypes/__init__.py
+++ b/Lib/ctypes/__init__.py
@@ -52,11 +52,11 @@
"""
def create_string_buffer(init, size=None):
- """create_string_buffer(aString) -> character array
+ """create_string_buffer(aBytes) -> character array
create_string_buffer(anInteger) -> character array
create_string_buffer(aString, anInteger) -> character array
"""
- if isinstance(init, str):
+ if isinstance(init, (str, bytes)):
if size is None:
size = len(init)+1
buftype = c_char * size