|
| 1 | +diff -ur '--exclude=*~' 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 16:46:24.000000000 +0100 |
| 3 | ++++ Python-2.7.2/Lib/ctypes/__init__.py 2015-03-19 12:32:45.747723687 +0000 |
| 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 | + |
| 64 | +diff -ur '--exclude=*~' Python-2.7.2.orig/Modules/_ctypes/callproc.c Python-2.7.2/Modules/_ctypes/callproc.c |
| 65 | +--- Python-2.7.2.orig/Modules/_ctypes/callproc.c 2015-03-19 11:56:40.668159317 +0000 |
| 66 | ++++ Python-2.7.2/Modules/_ctypes/callproc.c 2015-03-19 11:45:45.898288000 +0000 |
| 67 | +@@ -1423,7 +1423,7 @@ |
| 68 | + mode |= RTLD_NOW; |
| 69 | + handle = ctypes_dlopen(name, mode); |
| 70 | + if (!handle) { |
| 71 | +- char *errmsg = ctypes_dlerror(); |
| 72 | ++ const char *errmsg = ctypes_dlerror(); |
| 73 | + if (!errmsg) |
| 74 | + errmsg = "dlopen() error"; |
| 75 | + PyErr_SetString(PyExc_OSError, |
| 76 | +diff -ur '--exclude=*~' Python-2.7.2.orig/Modules/_ctypes/libffi/src/dlmalloc.c Python-2.7.2/Modules/_ctypes/libffi/src/dlmalloc.c |
| 77 | +--- Python-2.7.2.orig/Modules/_ctypes/libffi/src/dlmalloc.c 2015-03-19 13:26:58.928438829 +0000 |
| 78 | ++++ Python-2.7.2/Modules/_ctypes/libffi/src/dlmalloc.c 2015-03-19 15:32:19.042396376 +0000 |
| 79 | +@@ -614,18 +614,6 @@ |
| 80 | + #include "/usr/include/malloc.h" |
| 81 | + #else /* HAVE_USR_INCLUDE_MALLOC_H */ |
| 82 | + |
| 83 | +-struct mallinfo { |
| 84 | +- MALLINFO_FIELD_TYPE arena; /* non-mmapped space allocated from system */ |
| 85 | +- MALLINFO_FIELD_TYPE ordblks; /* number of free chunks */ |
| 86 | +- MALLINFO_FIELD_TYPE smblks; /* always 0 */ |
| 87 | +- MALLINFO_FIELD_TYPE hblks; /* always 0 */ |
| 88 | +- MALLINFO_FIELD_TYPE hblkhd; /* space in mmapped regions */ |
| 89 | +- MALLINFO_FIELD_TYPE usmblks; /* maximum total allocated space */ |
| 90 | +- MALLINFO_FIELD_TYPE fsmblks; /* always 0 */ |
| 91 | +- MALLINFO_FIELD_TYPE uordblks; /* total allocated space */ |
| 92 | +- MALLINFO_FIELD_TYPE fordblks; /* total free space */ |
| 93 | +- MALLINFO_FIELD_TYPE keepcost; /* releasable (via malloc_trim) space */ |
| 94 | +-}; |
| 95 | + |
| 96 | + #endif /* HAVE_USR_INCLUDE_MALLOC_H */ |
| 97 | + #endif /* NO_MALLINFO */ |
| 98 | +@@ -966,7 +954,7 @@ |
| 99 | + p = malloc(n); |
| 100 | + assert(malloc_usable_size(p) >= 256); |
| 101 | + */ |
| 102 | +-size_t dlmalloc_usable_size(void*); |
| 103 | ++size_t dlmalloc_usable_size(const void*); |
| 104 | + |
| 105 | + /* |
| 106 | + malloc_stats(); |
| 107 | +@@ -4384,7 +4372,7 @@ |
| 108 | + internal_malloc_stats(gm); |
| 109 | + } |
| 110 | + |
| 111 | +-size_t dlmalloc_usable_size(void* mem) { |
| 112 | ++size_t dlmalloc_usable_size(const void* mem) { |
| 113 | + if (mem != 0) { |
| 114 | + mchunkptr p = mem2chunk(mem); |
| 115 | + if (cinuse(p)) |
| 116 | + |
0 commit comments