1 diff -up Python-2.7rc1/Modules/_ctypes/callbacks.c.selinux Python-2.7rc1/Modules/_ctypes/callbacks.c
2 --- Python-2.7rc1/Modules/_ctypes/callbacks.c.selinux 2010-05-09 10:46:46.000000000 -0400
3 +++ Python-2.7rc1/Modules/_ctypes/callbacks.c 2010-06-08 08:44:18.357366200 -0400
4 @@ -21,8 +21,8 @@ CThunkObject_dealloc(PyObject *_self)
5 Py_XDECREF(self->converters);
6 Py_XDECREF(self->callable);
7 Py_XDECREF(self->restype);
9 - _ctypes_free_closure(self->pcl);
10 + if (self->pcl_write)
11 + ffi_closure_free(self->pcl_write);
12 PyObject_GC_Del(self);
15 @@ -391,7 +391,8 @@ static CThunkObject* CThunkObject_new(Py
21 + p->pcl_write = NULL;
22 memset(&p->cif, 0, sizeof(p->cif));
25 @@ -421,8 +422,9 @@ CThunkObject *_ctypes_alloc_callback(PyO
27 assert(CThunk_CheckExact(p));
29 - p->pcl = _ctypes_alloc_closure();
30 - if (p->pcl == NULL) {
31 + p->pcl_write = ffi_closure_alloc(sizeof(ffi_closure),
33 + if (p->pcl_write == NULL) {
37 @@ -467,7 +469,9 @@ CThunkObject *_ctypes_alloc_callback(PyO
38 "ffi_prep_cif failed with %d", result);
41 - result = ffi_prep_closure(p->pcl, &p->cif, closure_fcn, p);
42 + result = ffi_prep_closure_loc(p->pcl_write, &p->cif, closure_fcn,
45 if (result != FFI_OK) {
46 PyErr_Format(PyExc_RuntimeError,
47 "ffi_prep_closure failed with %d", result);
48 diff -up Python-2.7rc1/Modules/_ctypes/_ctypes.c.selinux Python-2.7rc1/Modules/_ctypes/_ctypes.c
49 --- Python-2.7rc1/Modules/_ctypes/_ctypes.c.selinux 2010-05-09 10:46:46.000000000 -0400
50 +++ Python-2.7rc1/Modules/_ctypes/_ctypes.c 2010-06-07 23:19:39.950146038 -0400
51 @@ -3463,7 +3463,7 @@ PyCFuncPtr_new(PyTypeObject *type, PyObj
52 self->callable = callable;
55 - *(void **)self->b_ptr = (void *)thunk->pcl;
56 + *(void **)self->b_ptr = (void *)thunk->pcl_exec;
58 Py_INCREF((PyObject *)thunk); /* for KeepRef */
59 if (-1 == KeepRef((CDataObject *)self, 0, (PyObject *)thunk)) {
60 diff -up Python-2.7rc1/Modules/_ctypes/ctypes.h.selinux Python-2.7rc1/Modules/_ctypes/ctypes.h
61 --- Python-2.7rc1/Modules/_ctypes/ctypes.h.selinux 2010-05-09 10:46:46.000000000 -0400
62 +++ Python-2.7rc1/Modules/_ctypes/ctypes.h 2010-06-07 23:19:39.950146038 -0400
63 @@ -95,7 +95,8 @@ struct tagCDataObject {
67 - ffi_closure *pcl; /* the C callable */
68 + ffi_closure *pcl_write; /* the C callable, writeable */
69 + void *pcl_exec; /* the C callable, executable */
73 diff -up Python-2.7rc1/setup.py.selinux Python-2.7rc1/setup.py
74 --- Python-2.7rc1/setup.py.selinux 2010-06-07 23:19:39.922147795 -0400
75 +++ Python-2.7rc1/setup.py 2010-06-07 23:19:39.951145942 -0400
76 @@ -1864,8 +1864,7 @@ class PyBuildExt(build_ext):
77 '_ctypes/callbacks.c',
81 - '_ctypes/malloc_closure.c']
83 depends = ['_ctypes/ctypes.h']
85 if sys.platform == 'darwin':