|
| 1 | +diff -uNr Python-2.7.2.orig/Lib/ctypes/__init__.py Python-2.7.2/Lib/ctypes/__init__.py |
| 2 | +--- Python-2.7.2.orig/Lib/ctypes/__init__.py 2011-06-11 17:46:24.000000000 +0200 |
| 3 | ++++ Python-2.7.2/Lib/ctypes/__init__.py 2012-08-30 13:40:38.837698797 +0200 |
| 4 | +@@ -272,31 +272,34 @@ |
| 5 | + else: |
| 6 | + set_conversion_mode("ascii", "strict") |
| 7 | + |
| 8 | +- class c_wchar_p(_SimpleCData): |
| 9 | +- _type_ = "Z" |
| 10 | +- |
| 11 | +- class c_wchar(_SimpleCData): |
| 12 | +- _type_ = "u" |
| 13 | +- |
| 14 | +- POINTER(c_wchar).from_param = c_wchar_p.from_param #_SimpleCData.c_wchar_p_from_param |
| 15 | +- |
| 16 | +- def create_unicode_buffer(init, size=None): |
| 17 | +- """create_unicode_buffer(aString) -> character array |
| 18 | +- create_unicode_buffer(anInteger) -> character array |
| 19 | +- create_unicode_buffer(aString, anInteger) -> character array |
| 20 | +- """ |
| 21 | +- if isinstance(init, (str, unicode)): |
| 22 | +- if size is None: |
| 23 | +- size = len(init)+1 |
| 24 | +- buftype = c_wchar * size |
| 25 | +- buf = buftype() |
| 26 | +- buf.value = init |
| 27 | +- return buf |
| 28 | +- elif isinstance(init, (int, long)): |
| 29 | +- buftype = c_wchar * init |
| 30 | +- buf = buftype() |
| 31 | +- return buf |
| 32 | +- raise TypeError(init) |
| 33 | ++# The wchar stuff causes a crash on Android (the bionic C library doesn't |
| 34 | ++# implement wchar_t anyway) |
| 35 | ++# |
| 36 | ++# class c_wchar_p(_SimpleCData): |
| 37 | ++# _type_ = "Z" |
| 38 | ++# |
| 39 | ++# class c_wchar(_SimpleCData): |
| 40 | ++# _type_ = "u" |
| 41 | ++# |
| 42 | ++# POINTER(c_wchar).from_param = c_wchar_p.from_param #_SimpleCData.c_wchar_p_from_param |
| 43 | ++# |
| 44 | ++# def create_unicode_buffer(init, size=None): |
| 45 | ++# """create_unicode_buffer(aString) -> character array |
| 46 | ++# create_unicode_buffer(anInteger) -> character array |
| 47 | ++# create_unicode_buffer(aString, anInteger) -> character array |
| 48 | ++# """ |
| 49 | ++# if isinstance(init, (str, unicode)): |
| 50 | ++# if size is None: |
| 51 | ++# size = len(init)+1 |
| 52 | ++# buftype = c_wchar * size |
| 53 | ++# buf = buftype() |
| 54 | ++# buf.value = init |
| 55 | ++# return buf |
| 56 | ++# elif isinstance(init, (int, long)): |
| 57 | ++# buftype = c_wchar * init |
| 58 | ++# buf = buftype() |
| 59 | ++# return buf |
| 60 | ++# raise TypeError(init) |
| 61 | + |
| 62 | + POINTER(c_char).from_param = c_char_p.from_param #_SimpleCData.c_char_p_from_param |
| 63 | + |
0 commit comments