]>
Commit | Line | Data |
---|---|---|
67bc7ab2 MT |
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); | |
8 | - if (self->pcl) | |
9 | - _ctypes_free_closure(self->pcl); | |
10 | + if (self->pcl_write) | |
11 | + ffi_closure_free(self->pcl_write); | |
12 | PyObject_GC_Del(self); | |
13 | } | |
14 | ||
15 | @@ -391,7 +391,8 @@ static CThunkObject* CThunkObject_new(Py | |
16 | return NULL; | |
17 | } | |
18 | ||
19 | - p->pcl = NULL; | |
20 | + p->pcl_exec = NULL; | |
21 | + p->pcl_write = NULL; | |
22 | memset(&p->cif, 0, sizeof(p->cif)); | |
23 | p->converters = NULL; | |
24 | p->callable = NULL; | |
25 | @@ -421,8 +422,9 @@ CThunkObject *_ctypes_alloc_callback(PyO | |
26 | ||
27 | assert(CThunk_CheckExact(p)); | |
28 | ||
29 | - p->pcl = _ctypes_alloc_closure(); | |
30 | - if (p->pcl == NULL) { | |
31 | + p->pcl_write = ffi_closure_alloc(sizeof(ffi_closure), | |
32 | + &p->pcl_exec); | |
33 | + if (p->pcl_write == NULL) { | |
34 | PyErr_NoMemory(); | |
35 | goto error; | |
36 | } | |
37 | @@ -467,7 +469,9 @@ CThunkObject *_ctypes_alloc_callback(PyO | |
38 | "ffi_prep_cif failed with %d", result); | |
39 | goto error; | |
40 | } | |
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, | |
43 | + p, | |
44 | + p->pcl_exec); | |
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; | |
53 | ||
54 | self->thunk = thunk; | |
55 | - *(void **)self->b_ptr = (void *)thunk->pcl; | |
56 | + *(void **)self->b_ptr = (void *)thunk->pcl_exec; | |
57 | ||
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 { | |
64 | ||
65 | typedef struct { | |
66 | PyObject_VAR_HEAD | |
67 | - ffi_closure *pcl; /* the C callable */ | |
68 | + ffi_closure *pcl_write; /* the C callable, writeable */ | |
69 | + void *pcl_exec; /* the C callable, executable */ | |
70 | ffi_cif cif; | |
71 | int flags; | |
72 | PyObject *converters; | |
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', | |
78 | '_ctypes/callproc.c', | |
79 | '_ctypes/stgdict.c', | |
80 | - '_ctypes/cfield.c', | |
81 | - '_ctypes/malloc_closure.c'] | |
82 | + '_ctypes/cfield.c'] | |
83 | depends = ['_ctypes/ctypes.h'] | |
84 | ||
85 | if sys.platform == 'darwin': |