summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/_ctypes.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index fe33253..b652319 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -474,7 +474,7 @@ GenericCData_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
static PyObject *
CDataType_from_buffer_copy(PyObject *type, PyObject *args)
{
- void *buffer;
+ const void *buffer;
Py_ssize_t buffer_len;
Py_ssize_t offset = 0;
PyObject *obj, *result;
@@ -3849,6 +3849,25 @@ CFuncPtr_repr(CFuncPtrObject *self)
self);
}
+static int
+Pointer_bool(CDataObject *self)
+{
+ return *(void **)self->b_ptr != NULL;
+}
+
+static PyNumberMethods Pointer_as_number = {
+ 0, /* nb_add */
+ 0, /* nb_subtract */
+ 0, /* nb_multiply */
+ 0, /* nb_remainder */
+ 0, /* nb_divmod */
+ 0, /* nb_power */
+ 0, /* nb_negative */
+ 0, /* nb_positive */
+ 0, /* nb_absolute */
+ (inquiry)Pointer_bool, /* nb_bool */
+};
+
PyTypeObject CFuncPtr_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"_ctypes.CFuncPtr",
@@ -3860,7 +3879,7 @@ PyTypeObject CFuncPtr_Type = {
0, /* tp_setattr */
0, /* tp_compare */
(reprfunc)CFuncPtr_repr, /* tp_repr */
- 0, /* tp_as_number */
+ &Pointer_as_number, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
0, /* tp_hash */
@@ -4933,25 +4952,6 @@ static PyMappingMethods Pointer_as_mapping = {
Pointer_subscript,
};
-static int
-Pointer_bool(CDataObject *self)
-{
- return *(void **)self->b_ptr != NULL;
-}
-
-static PyNumberMethods Pointer_as_number = {
- 0, /* nb_add */
- 0, /* nb_subtract */
- 0, /* nb_multiply */
- 0, /* nb_remainder */
- 0, /* nb_divmod */
- 0, /* nb_power */
- 0, /* nb_negative */
- 0, /* nb_positive */
- 0, /* nb_absolute */
- (inquiry)Pointer_bool, /* nb_bool */
-};
-
PyTypeObject Pointer_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
"_ctypes._Pointer",