| 1 |
/*[clinic input] |
| 2 |
preserve |
| 3 |
[clinic start generated code]*/ |
| 4 |
|
| 5 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 6 |
# include "pycore_runtime.h" // _Py_SINGLETON() |
| 7 |
#endif |
| 8 |
#include "pycore_abstract.h" // _PyNumber_Index() |
| 9 |
#include "pycore_critical_section.h"// Py_BEGIN_CRITICAL_SECTION() |
| 10 |
#include "pycore_modsupport.h" // _PyArg_UnpackKeywords() |
| 11 |
|
| 12 |
PyDoc_STRVAR(_ctypes_CType_Type___sizeof____doc__, |
| 13 |
"__sizeof__($self, /)\n" |
| 14 |
"--\n" |
| 15 |
"\n" |
| 16 |
"Return memory consumption of the type object."); |
| 17 |
|
| 18 |
#define _CTYPES_CTYPE_TYPE___SIZEOF___METHODDEF \ |
| 19 |
{"__sizeof__", _PyCFunction_CAST(_ctypes_CType_Type___sizeof__), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _ctypes_CType_Type___sizeof____doc__}, |
| 20 |
|
| 21 |
static PyObject * |
| 22 |
_ctypes_CType_Type___sizeof___impl(PyObject *self, PyTypeObject *cls); |
| 23 |
|
| 24 |
static PyObject * |
| 25 |
_ctypes_CType_Type___sizeof__(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 26 |
{ |
| 27 |
if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) { |
| 28 |
PyErr_SetString(PyExc_TypeError, "__sizeof__() takes no arguments"); |
| 29 |
return NULL; |
| 30 |
} |
| 31 |
return _ctypes_CType_Type___sizeof___impl(self, cls); |
| 32 |
} |
| 33 |
|
| 34 |
PyDoc_STRVAR(CDataType_from_address__doc__, |
| 35 |
"from_address($self, value, /)\n" |
| 36 |
"--\n" |
| 37 |
"\n" |
| 38 |
"C.from_address(integer) -> C instance\n" |
| 39 |
"\n" |
| 40 |
"Access a C instance at the specified address."); |
| 41 |
|
| 42 |
#define CDATATYPE_FROM_ADDRESS_METHODDEF \ |
| 43 |
{"from_address", _PyCFunction_CAST(CDataType_from_address), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, CDataType_from_address__doc__}, |
| 44 |
|
| 45 |
static PyObject * |
| 46 |
CDataType_from_address_impl(PyObject *type, PyTypeObject *cls, |
| 47 |
PyObject *value); |
| 48 |
|
| 49 |
static PyObject * |
| 50 |
CDataType_from_address(PyObject *type, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 51 |
{ |
| 52 |
PyObject *return_value = NULL; |
| 53 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 54 |
# define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty) |
| 55 |
#else |
| 56 |
# define KWTUPLE NULL |
| 57 |
#endif |
| 58 |
|
| 59 |
static const char * const _keywords[] = {"", NULL}; |
| 60 |
static _PyArg_Parser _parser = { |
| 61 |
.keywords = _keywords, |
| 62 |
.fname = "from_address", |
| 63 |
.kwtuple = KWTUPLE, |
| 64 |
}; |
| 65 |
#undef KWTUPLE |
| 66 |
PyObject *argsbuf[1]; |
| 67 |
PyObject *value; |
| 68 |
|
| 69 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 70 |
/*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 71 |
if (!args) { |
| 72 |
goto exit; |
| 73 |
} |
| 74 |
value = args[0]; |
| 75 |
return_value = CDataType_from_address_impl(type, cls, value); |
| 76 |
|
| 77 |
exit: |
| 78 |
return return_value; |
| 79 |
} |
| 80 |
|
| 81 |
PyDoc_STRVAR(CDataType_from_buffer__doc__, |
| 82 |
"from_buffer($self, obj, offset=0, /)\n" |
| 83 |
"--\n" |
| 84 |
"\n" |
| 85 |
"C.from_buffer(object, offset=0) -> C instance\n" |
| 86 |
"\n" |
| 87 |
"Create a C instance from a writeable buffer."); |
| 88 |
|
| 89 |
#define CDATATYPE_FROM_BUFFER_METHODDEF \ |
| 90 |
{"from_buffer", _PyCFunction_CAST(CDataType_from_buffer), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, CDataType_from_buffer__doc__}, |
| 91 |
|
| 92 |
static PyObject * |
| 93 |
CDataType_from_buffer_impl(PyObject *type, PyTypeObject *cls, PyObject *obj, |
| 94 |
Py_ssize_t offset); |
| 95 |
|
| 96 |
static PyObject * |
| 97 |
CDataType_from_buffer(PyObject *type, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 98 |
{ |
| 99 |
PyObject *return_value = NULL; |
| 100 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 101 |
# define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty) |
| 102 |
#else |
| 103 |
# define KWTUPLE NULL |
| 104 |
#endif |
| 105 |
|
| 106 |
static const char * const _keywords[] = {"", "", NULL}; |
| 107 |
static _PyArg_Parser _parser = { |
| 108 |
.keywords = _keywords, |
| 109 |
.fname = "from_buffer", |
| 110 |
.kwtuple = KWTUPLE, |
| 111 |
}; |
| 112 |
#undef KWTUPLE |
| 113 |
PyObject *argsbuf[2]; |
| 114 |
PyObject *obj; |
| 115 |
Py_ssize_t offset = 0; |
| 116 |
|
| 117 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 118 |
/*minpos*/ 1, /*maxpos*/ 2, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 119 |
if (!args) { |
| 120 |
goto exit; |
| 121 |
} |
| 122 |
obj = args[0]; |
| 123 |
if (nargs < 2) { |
| 124 |
goto skip_optional_posonly; |
| 125 |
} |
| 126 |
{ |
| 127 |
Py_ssize_t ival = -1; |
| 128 |
PyObject *iobj = _PyNumber_Index(args[1]); |
| 129 |
if (iobj != NULL) { |
| 130 |
ival = PyLong_AsSsize_t(iobj); |
| 131 |
Py_DECREF(iobj); |
| 132 |
} |
| 133 |
if (ival == -1 && PyErr_Occurred()) { |
| 134 |
goto exit; |
| 135 |
} |
| 136 |
offset = ival; |
| 137 |
} |
| 138 |
skip_optional_posonly: |
| 139 |
return_value = CDataType_from_buffer_impl(type, cls, obj, offset); |
| 140 |
|
| 141 |
exit: |
| 142 |
return return_value; |
| 143 |
} |
| 144 |
|
| 145 |
PyDoc_STRVAR(CDataType_from_buffer_copy__doc__, |
| 146 |
"from_buffer_copy($self, buffer, offset=0, /)\n" |
| 147 |
"--\n" |
| 148 |
"\n" |
| 149 |
"C.from_buffer_copy(object, offset=0) -> C instance\n" |
| 150 |
"\n" |
| 151 |
"Create a C instance from a readable buffer."); |
| 152 |
|
| 153 |
#define CDATATYPE_FROM_BUFFER_COPY_METHODDEF \ |
| 154 |
{"from_buffer_copy", _PyCFunction_CAST(CDataType_from_buffer_copy), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, CDataType_from_buffer_copy__doc__}, |
| 155 |
|
| 156 |
static PyObject * |
| 157 |
CDataType_from_buffer_copy_impl(PyObject *type, PyTypeObject *cls, |
| 158 |
Py_buffer *buffer, Py_ssize_t offset); |
| 159 |
|
| 160 |
static PyObject * |
| 161 |
CDataType_from_buffer_copy(PyObject *type, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 162 |
{ |
| 163 |
PyObject *return_value = NULL; |
| 164 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 165 |
# define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty) |
| 166 |
#else |
| 167 |
# define KWTUPLE NULL |
| 168 |
#endif |
| 169 |
|
| 170 |
static const char * const _keywords[] = {"", "", NULL}; |
| 171 |
static _PyArg_Parser _parser = { |
| 172 |
.keywords = _keywords, |
| 173 |
.fname = "from_buffer_copy", |
| 174 |
.kwtuple = KWTUPLE, |
| 175 |
}; |
| 176 |
#undef KWTUPLE |
| 177 |
PyObject *argsbuf[2]; |
| 178 |
Py_buffer buffer = {NULL, NULL}; |
| 179 |
Py_ssize_t offset = 0; |
| 180 |
|
| 181 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 182 |
/*minpos*/ 1, /*maxpos*/ 2, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 183 |
if (!args) { |
| 184 |
goto exit; |
| 185 |
} |
| 186 |
if (PyObject_GetBuffer(args[0], &buffer, PyBUF_SIMPLE) != 0) { |
| 187 |
goto exit; |
| 188 |
} |
| 189 |
if (nargs < 2) { |
| 190 |
goto skip_optional_posonly; |
| 191 |
} |
| 192 |
{ |
| 193 |
Py_ssize_t ival = -1; |
| 194 |
PyObject *iobj = _PyNumber_Index(args[1]); |
| 195 |
if (iobj != NULL) { |
| 196 |
ival = PyLong_AsSsize_t(iobj); |
| 197 |
Py_DECREF(iobj); |
| 198 |
} |
| 199 |
if (ival == -1 && PyErr_Occurred()) { |
| 200 |
goto exit; |
| 201 |
} |
| 202 |
offset = ival; |
| 203 |
} |
| 204 |
skip_optional_posonly: |
| 205 |
return_value = CDataType_from_buffer_copy_impl(type, cls, &buffer, offset); |
| 206 |
|
| 207 |
exit: |
| 208 |
/* Cleanup for buffer */ |
| 209 |
if (buffer.obj) { |
| 210 |
PyBuffer_Release(&buffer); |
| 211 |
} |
| 212 |
|
| 213 |
return return_value; |
| 214 |
} |
| 215 |
|
| 216 |
PyDoc_STRVAR(CDataType_in_dll__doc__, |
| 217 |
"in_dll($self, dll, name, /)\n" |
| 218 |
"--\n" |
| 219 |
"\n" |
| 220 |
"C.in_dll(dll, name) -> C instance\n" |
| 221 |
"\n" |
| 222 |
"Access a C instance in a dll."); |
| 223 |
|
| 224 |
#define CDATATYPE_IN_DLL_METHODDEF \ |
| 225 |
{"in_dll", _PyCFunction_CAST(CDataType_in_dll), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, CDataType_in_dll__doc__}, |
| 226 |
|
| 227 |
static PyObject * |
| 228 |
CDataType_in_dll_impl(PyObject *type, PyTypeObject *cls, PyObject *dll, |
| 229 |
const char *name); |
| 230 |
|
| 231 |
static PyObject * |
| 232 |
CDataType_in_dll(PyObject *type, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 233 |
{ |
| 234 |
PyObject *return_value = NULL; |
| 235 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 236 |
# define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty) |
| 237 |
#else |
| 238 |
# define KWTUPLE NULL |
| 239 |
#endif |
| 240 |
|
| 241 |
static const char * const _keywords[] = {"", "", NULL}; |
| 242 |
static _PyArg_Parser _parser = { |
| 243 |
.keywords = _keywords, |
| 244 |
.fname = "in_dll", |
| 245 |
.kwtuple = KWTUPLE, |
| 246 |
}; |
| 247 |
#undef KWTUPLE |
| 248 |
PyObject *argsbuf[2]; |
| 249 |
PyObject *dll; |
| 250 |
const char *name; |
| 251 |
|
| 252 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 253 |
/*minpos*/ 2, /*maxpos*/ 2, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 254 |
if (!args) { |
| 255 |
goto exit; |
| 256 |
} |
| 257 |
dll = args[0]; |
| 258 |
if (!PyUnicode_Check(args[1])) { |
| 259 |
_PyArg_BadArgument("in_dll", "argument 2", "str", args[1]); |
| 260 |
goto exit; |
| 261 |
} |
| 262 |
Py_ssize_t name_length; |
| 263 |
name = PyUnicode_AsUTF8AndSize(args[1], &name_length); |
| 264 |
if (name == NULL) { |
| 265 |
goto exit; |
| 266 |
} |
| 267 |
if (strlen(name) != (size_t)name_length) { |
| 268 |
PyErr_SetString(PyExc_ValueError, "embedded null character"); |
| 269 |
goto exit; |
| 270 |
} |
| 271 |
return_value = CDataType_in_dll_impl(type, cls, dll, name); |
| 272 |
|
| 273 |
exit: |
| 274 |
return return_value; |
| 275 |
} |
| 276 |
|
| 277 |
PyDoc_STRVAR(CDataType_from_param__doc__, |
| 278 |
"from_param($self, value, /)\n" |
| 279 |
"--\n" |
| 280 |
"\n" |
| 281 |
"Convert a Python object into a function call parameter."); |
| 282 |
|
| 283 |
#define CDATATYPE_FROM_PARAM_METHODDEF \ |
| 284 |
{"from_param", _PyCFunction_CAST(CDataType_from_param), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, CDataType_from_param__doc__}, |
| 285 |
|
| 286 |
static PyObject * |
| 287 |
CDataType_from_param_impl(PyObject *type, PyTypeObject *cls, PyObject *value); |
| 288 |
|
| 289 |
static PyObject * |
| 290 |
CDataType_from_param(PyObject *type, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 291 |
{ |
| 292 |
PyObject *return_value = NULL; |
| 293 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 294 |
# define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty) |
| 295 |
#else |
| 296 |
# define KWTUPLE NULL |
| 297 |
#endif |
| 298 |
|
| 299 |
static const char * const _keywords[] = {"", NULL}; |
| 300 |
static _PyArg_Parser _parser = { |
| 301 |
.keywords = _keywords, |
| 302 |
.fname = "from_param", |
| 303 |
.kwtuple = KWTUPLE, |
| 304 |
}; |
| 305 |
#undef KWTUPLE |
| 306 |
PyObject *argsbuf[1]; |
| 307 |
PyObject *value; |
| 308 |
|
| 309 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 310 |
/*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 311 |
if (!args) { |
| 312 |
goto exit; |
| 313 |
} |
| 314 |
value = args[0]; |
| 315 |
return_value = CDataType_from_param_impl(type, cls, value); |
| 316 |
|
| 317 |
exit: |
| 318 |
return return_value; |
| 319 |
} |
| 320 |
|
| 321 |
PyDoc_STRVAR(PyCPointerType_set_type__doc__, |
| 322 |
"set_type($self, type, /)\n" |
| 323 |
"--\n" |
| 324 |
"\n"); |
| 325 |
|
| 326 |
#define PYCPOINTERTYPE_SET_TYPE_METHODDEF \ |
| 327 |
{"set_type", _PyCFunction_CAST(PyCPointerType_set_type), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, PyCPointerType_set_type__doc__}, |
| 328 |
|
| 329 |
static PyObject * |
| 330 |
PyCPointerType_set_type_impl(PyTypeObject *self, PyTypeObject *cls, |
| 331 |
PyObject *type); |
| 332 |
|
| 333 |
static PyObject * |
| 334 |
PyCPointerType_set_type(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 335 |
{ |
| 336 |
PyObject *return_value = NULL; |
| 337 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 338 |
# define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty) |
| 339 |
#else |
| 340 |
# define KWTUPLE NULL |
| 341 |
#endif |
| 342 |
|
| 343 |
static const char * const _keywords[] = {"", NULL}; |
| 344 |
static _PyArg_Parser _parser = { |
| 345 |
.keywords = _keywords, |
| 346 |
.fname = "set_type", |
| 347 |
.kwtuple = KWTUPLE, |
| 348 |
}; |
| 349 |
#undef KWTUPLE |
| 350 |
PyObject *argsbuf[1]; |
| 351 |
PyObject *type; |
| 352 |
|
| 353 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 354 |
/*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 355 |
if (!args) { |
| 356 |
goto exit; |
| 357 |
} |
| 358 |
type = args[0]; |
| 359 |
return_value = PyCPointerType_set_type_impl((PyTypeObject *)self, cls, type); |
| 360 |
|
| 361 |
exit: |
| 362 |
return return_value; |
| 363 |
} |
| 364 |
|
| 365 |
PyDoc_STRVAR(PyCPointerType_from_param__doc__, |
| 366 |
"from_param($self, value, /)\n" |
| 367 |
"--\n" |
| 368 |
"\n" |
| 369 |
"Convert a Python object into a function call parameter."); |
| 370 |
|
| 371 |
#define PYCPOINTERTYPE_FROM_PARAM_METHODDEF \ |
| 372 |
{"from_param", _PyCFunction_CAST(PyCPointerType_from_param), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, PyCPointerType_from_param__doc__}, |
| 373 |
|
| 374 |
static PyObject * |
| 375 |
PyCPointerType_from_param_impl(PyObject *type, PyTypeObject *cls, |
| 376 |
PyObject *value); |
| 377 |
|
| 378 |
static PyObject * |
| 379 |
PyCPointerType_from_param(PyObject *type, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 380 |
{ |
| 381 |
PyObject *return_value = NULL; |
| 382 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 383 |
# define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty) |
| 384 |
#else |
| 385 |
# define KWTUPLE NULL |
| 386 |
#endif |
| 387 |
|
| 388 |
static const char * const _keywords[] = {"", NULL}; |
| 389 |
static _PyArg_Parser _parser = { |
| 390 |
.keywords = _keywords, |
| 391 |
.fname = "from_param", |
| 392 |
.kwtuple = KWTUPLE, |
| 393 |
}; |
| 394 |
#undef KWTUPLE |
| 395 |
PyObject *argsbuf[1]; |
| 396 |
PyObject *value; |
| 397 |
|
| 398 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 399 |
/*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 400 |
if (!args) { |
| 401 |
goto exit; |
| 402 |
} |
| 403 |
value = args[0]; |
| 404 |
return_value = PyCPointerType_from_param_impl(type, cls, value); |
| 405 |
|
| 406 |
exit: |
| 407 |
return return_value; |
| 408 |
} |
| 409 |
|
| 410 |
#if !defined(_ctypes_PyCArrayType_Type_raw_DOCSTR) |
| 411 |
# define _ctypes_PyCArrayType_Type_raw_DOCSTR NULL |
| 412 |
#endif |
| 413 |
#if defined(_CTYPES_PYCARRAYTYPE_TYPE_RAW_GETSETDEF) |
| 414 |
# undef _CTYPES_PYCARRAYTYPE_TYPE_RAW_GETSETDEF |
| 415 |
# define _CTYPES_PYCARRAYTYPE_TYPE_RAW_GETSETDEF {"raw", (getter)_ctypes_PyCArrayType_Type_raw_get, (setter)_ctypes_PyCArrayType_Type_raw_set, _ctypes_PyCArrayType_Type_raw_DOCSTR}, |
| 416 |
#else |
| 417 |
# define _CTYPES_PYCARRAYTYPE_TYPE_RAW_GETSETDEF {"raw", NULL, (setter)_ctypes_PyCArrayType_Type_raw_set, NULL}, |
| 418 |
#endif |
| 419 |
|
| 420 |
static int |
| 421 |
_ctypes_PyCArrayType_Type_raw_set_impl(CDataObject *self, PyObject *value); |
| 422 |
|
| 423 |
static int |
| 424 |
_ctypes_PyCArrayType_Type_raw_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
| 425 |
{ |
| 426 |
int return_value; |
| 427 |
|
| 428 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 429 |
return_value = _ctypes_PyCArrayType_Type_raw_set_impl((CDataObject *)self, value); |
| 430 |
Py_END_CRITICAL_SECTION(); |
| 431 |
|
| 432 |
return return_value; |
| 433 |
} |
| 434 |
|
| 435 |
#if !defined(_ctypes_PyCArrayType_Type_raw_DOCSTR) |
| 436 |
# define _ctypes_PyCArrayType_Type_raw_DOCSTR NULL |
| 437 |
#endif |
| 438 |
#if defined(_CTYPES_PYCARRAYTYPE_TYPE_RAW_GETSETDEF) |
| 439 |
# undef _CTYPES_PYCARRAYTYPE_TYPE_RAW_GETSETDEF |
| 440 |
# define _CTYPES_PYCARRAYTYPE_TYPE_RAW_GETSETDEF {"raw", (getter)_ctypes_PyCArrayType_Type_raw_get, (setter)_ctypes_PyCArrayType_Type_raw_set, _ctypes_PyCArrayType_Type_raw_DOCSTR}, |
| 441 |
#else |
| 442 |
# define _CTYPES_PYCARRAYTYPE_TYPE_RAW_GETSETDEF {"raw", (getter)_ctypes_PyCArrayType_Type_raw_get, NULL, _ctypes_PyCArrayType_Type_raw_DOCSTR}, |
| 443 |
#endif |
| 444 |
|
| 445 |
static PyObject * |
| 446 |
_ctypes_PyCArrayType_Type_raw_get_impl(CDataObject *self); |
| 447 |
|
| 448 |
static PyObject * |
| 449 |
_ctypes_PyCArrayType_Type_raw_get(PyObject *self, void *Py_UNUSED(context)) |
| 450 |
{ |
| 451 |
PyObject *return_value = NULL; |
| 452 |
|
| 453 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 454 |
return_value = _ctypes_PyCArrayType_Type_raw_get_impl((CDataObject *)self); |
| 455 |
Py_END_CRITICAL_SECTION(); |
| 456 |
|
| 457 |
return return_value; |
| 458 |
} |
| 459 |
|
| 460 |
#if !defined(_ctypes_PyCArrayType_Type_value_DOCSTR) |
| 461 |
# define _ctypes_PyCArrayType_Type_value_DOCSTR NULL |
| 462 |
#endif |
| 463 |
#if defined(_CTYPES_PYCARRAYTYPE_TYPE_VALUE_GETSETDEF) |
| 464 |
# undef _CTYPES_PYCARRAYTYPE_TYPE_VALUE_GETSETDEF |
| 465 |
# define _CTYPES_PYCARRAYTYPE_TYPE_VALUE_GETSETDEF {"value", (getter)_ctypes_PyCArrayType_Type_value_get, (setter)_ctypes_PyCArrayType_Type_value_set, _ctypes_PyCArrayType_Type_value_DOCSTR}, |
| 466 |
#else |
| 467 |
# define _CTYPES_PYCARRAYTYPE_TYPE_VALUE_GETSETDEF {"value", (getter)_ctypes_PyCArrayType_Type_value_get, NULL, _ctypes_PyCArrayType_Type_value_DOCSTR}, |
| 468 |
#endif |
| 469 |
|
| 470 |
static PyObject * |
| 471 |
_ctypes_PyCArrayType_Type_value_get_impl(CDataObject *self); |
| 472 |
|
| 473 |
static PyObject * |
| 474 |
_ctypes_PyCArrayType_Type_value_get(PyObject *self, void *Py_UNUSED(context)) |
| 475 |
{ |
| 476 |
PyObject *return_value = NULL; |
| 477 |
|
| 478 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 479 |
return_value = _ctypes_PyCArrayType_Type_value_get_impl((CDataObject *)self); |
| 480 |
Py_END_CRITICAL_SECTION(); |
| 481 |
|
| 482 |
return return_value; |
| 483 |
} |
| 484 |
|
| 485 |
#if !defined(_ctypes_PyCArrayType_Type_value_DOCSTR) |
| 486 |
# define _ctypes_PyCArrayType_Type_value_DOCSTR NULL |
| 487 |
#endif |
| 488 |
#if defined(_CTYPES_PYCARRAYTYPE_TYPE_VALUE_GETSETDEF) |
| 489 |
# undef _CTYPES_PYCARRAYTYPE_TYPE_VALUE_GETSETDEF |
| 490 |
# define _CTYPES_PYCARRAYTYPE_TYPE_VALUE_GETSETDEF {"value", (getter)_ctypes_PyCArrayType_Type_value_get, (setter)_ctypes_PyCArrayType_Type_value_set, _ctypes_PyCArrayType_Type_value_DOCSTR}, |
| 491 |
#else |
| 492 |
# define _CTYPES_PYCARRAYTYPE_TYPE_VALUE_GETSETDEF {"value", NULL, (setter)_ctypes_PyCArrayType_Type_value_set, NULL}, |
| 493 |
#endif |
| 494 |
|
| 495 |
static int |
| 496 |
_ctypes_PyCArrayType_Type_value_set_impl(CDataObject *self, PyObject *value); |
| 497 |
|
| 498 |
static int |
| 499 |
_ctypes_PyCArrayType_Type_value_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
| 500 |
{ |
| 501 |
int return_value; |
| 502 |
|
| 503 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 504 |
return_value = _ctypes_PyCArrayType_Type_value_set_impl((CDataObject *)self, value); |
| 505 |
Py_END_CRITICAL_SECTION(); |
| 506 |
|
| 507 |
return return_value; |
| 508 |
} |
| 509 |
|
| 510 |
PyDoc_STRVAR(c_wchar_p_from_param__doc__, |
| 511 |
"from_param($self, value, /)\n" |
| 512 |
"--\n" |
| 513 |
"\n"); |
| 514 |
|
| 515 |
#define C_WCHAR_P_FROM_PARAM_METHODDEF \ |
| 516 |
{"from_param", _PyCFunction_CAST(c_wchar_p_from_param), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, c_wchar_p_from_param__doc__}, |
| 517 |
|
| 518 |
static PyObject * |
| 519 |
c_wchar_p_from_param_impl(PyObject *type, PyTypeObject *cls, PyObject *value); |
| 520 |
|
| 521 |
static PyObject * |
| 522 |
c_wchar_p_from_param(PyObject *type, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 523 |
{ |
| 524 |
PyObject *return_value = NULL; |
| 525 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 526 |
# define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty) |
| 527 |
#else |
| 528 |
# define KWTUPLE NULL |
| 529 |
#endif |
| 530 |
|
| 531 |
static const char * const _keywords[] = {"", NULL}; |
| 532 |
static _PyArg_Parser _parser = { |
| 533 |
.keywords = _keywords, |
| 534 |
.fname = "from_param", |
| 535 |
.kwtuple = KWTUPLE, |
| 536 |
}; |
| 537 |
#undef KWTUPLE |
| 538 |
PyObject *argsbuf[1]; |
| 539 |
PyObject *value; |
| 540 |
|
| 541 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 542 |
/*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 543 |
if (!args) { |
| 544 |
goto exit; |
| 545 |
} |
| 546 |
value = args[0]; |
| 547 |
return_value = c_wchar_p_from_param_impl(type, cls, value); |
| 548 |
|
| 549 |
exit: |
| 550 |
return return_value; |
| 551 |
} |
| 552 |
|
| 553 |
PyDoc_STRVAR(c_char_p_from_param__doc__, |
| 554 |
"from_param($self, value, /)\n" |
| 555 |
"--\n" |
| 556 |
"\n"); |
| 557 |
|
| 558 |
#define C_CHAR_P_FROM_PARAM_METHODDEF \ |
| 559 |
{"from_param", _PyCFunction_CAST(c_char_p_from_param), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, c_char_p_from_param__doc__}, |
| 560 |
|
| 561 |
static PyObject * |
| 562 |
c_char_p_from_param_impl(PyObject *type, PyTypeObject *cls, PyObject *value); |
| 563 |
|
| 564 |
static PyObject * |
| 565 |
c_char_p_from_param(PyObject *type, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 566 |
{ |
| 567 |
PyObject *return_value = NULL; |
| 568 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 569 |
# define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty) |
| 570 |
#else |
| 571 |
# define KWTUPLE NULL |
| 572 |
#endif |
| 573 |
|
| 574 |
static const char * const _keywords[] = {"", NULL}; |
| 575 |
static _PyArg_Parser _parser = { |
| 576 |
.keywords = _keywords, |
| 577 |
.fname = "from_param", |
| 578 |
.kwtuple = KWTUPLE, |
| 579 |
}; |
| 580 |
#undef KWTUPLE |
| 581 |
PyObject *argsbuf[1]; |
| 582 |
PyObject *value; |
| 583 |
|
| 584 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 585 |
/*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 586 |
if (!args) { |
| 587 |
goto exit; |
| 588 |
} |
| 589 |
value = args[0]; |
| 590 |
return_value = c_char_p_from_param_impl(type, cls, value); |
| 591 |
|
| 592 |
exit: |
| 593 |
return return_value; |
| 594 |
} |
| 595 |
|
| 596 |
PyDoc_STRVAR(c_void_p_from_param__doc__, |
| 597 |
"from_param($self, value, /)\n" |
| 598 |
"--\n" |
| 599 |
"\n"); |
| 600 |
|
| 601 |
#define C_VOID_P_FROM_PARAM_METHODDEF \ |
| 602 |
{"from_param", _PyCFunction_CAST(c_void_p_from_param), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, c_void_p_from_param__doc__}, |
| 603 |
|
| 604 |
static PyObject * |
| 605 |
c_void_p_from_param_impl(PyObject *type, PyTypeObject *cls, PyObject *value); |
| 606 |
|
| 607 |
static PyObject * |
| 608 |
c_void_p_from_param(PyObject *type, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 609 |
{ |
| 610 |
PyObject *return_value = NULL; |
| 611 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 612 |
# define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty) |
| 613 |
#else |
| 614 |
# define KWTUPLE NULL |
| 615 |
#endif |
| 616 |
|
| 617 |
static const char * const _keywords[] = {"", NULL}; |
| 618 |
static _PyArg_Parser _parser = { |
| 619 |
.keywords = _keywords, |
| 620 |
.fname = "from_param", |
| 621 |
.kwtuple = KWTUPLE, |
| 622 |
}; |
| 623 |
#undef KWTUPLE |
| 624 |
PyObject *argsbuf[1]; |
| 625 |
PyObject *value; |
| 626 |
|
| 627 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 628 |
/*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 629 |
if (!args) { |
| 630 |
goto exit; |
| 631 |
} |
| 632 |
value = args[0]; |
| 633 |
return_value = c_void_p_from_param_impl(type, cls, value); |
| 634 |
|
| 635 |
exit: |
| 636 |
return return_value; |
| 637 |
} |
| 638 |
|
| 639 |
PyDoc_STRVAR(PyCSimpleType_from_param__doc__, |
| 640 |
"from_param($self, value, /)\n" |
| 641 |
"--\n" |
| 642 |
"\n" |
| 643 |
"Convert a Python object into a function call parameter."); |
| 644 |
|
| 645 |
#define PYCSIMPLETYPE_FROM_PARAM_METHODDEF \ |
| 646 |
{"from_param", _PyCFunction_CAST(PyCSimpleType_from_param), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, PyCSimpleType_from_param__doc__}, |
| 647 |
|
| 648 |
static PyObject * |
| 649 |
PyCSimpleType_from_param_impl(PyObject *type, PyTypeObject *cls, |
| 650 |
PyObject *value); |
| 651 |
|
| 652 |
static PyObject * |
| 653 |
PyCSimpleType_from_param(PyObject *type, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 654 |
{ |
| 655 |
PyObject *return_value = NULL; |
| 656 |
#if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
| 657 |
# define KWTUPLE (PyObject *)&_Py_SINGLETON(tuple_empty) |
| 658 |
#else |
| 659 |
# define KWTUPLE NULL |
| 660 |
#endif |
| 661 |
|
| 662 |
static const char * const _keywords[] = {"", NULL}; |
| 663 |
static _PyArg_Parser _parser = { |
| 664 |
.keywords = _keywords, |
| 665 |
.fname = "from_param", |
| 666 |
.kwtuple = KWTUPLE, |
| 667 |
}; |
| 668 |
#undef KWTUPLE |
| 669 |
PyObject *argsbuf[1]; |
| 670 |
PyObject *value; |
| 671 |
|
| 672 |
args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, |
| 673 |
/*minpos*/ 1, /*maxpos*/ 1, /*minkw*/ 0, /*varpos*/ 0, argsbuf); |
| 674 |
if (!args) { |
| 675 |
goto exit; |
| 676 |
} |
| 677 |
value = args[0]; |
| 678 |
return_value = PyCSimpleType_from_param_impl(type, cls, value); |
| 679 |
|
| 680 |
exit: |
| 681 |
return return_value; |
| 682 |
} |
| 683 |
|
| 684 |
PyDoc_STRVAR(_ctypes_PyCData___reduce____doc__, |
| 685 |
"__reduce__($self, /)\n" |
| 686 |
"--\n" |
| 687 |
"\n"); |
| 688 |
|
| 689 |
#define _CTYPES_PYCDATA___REDUCE___METHODDEF \ |
| 690 |
{"__reduce__", _PyCFunction_CAST(_ctypes_PyCData___reduce__), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, _ctypes_PyCData___reduce____doc__}, |
| 691 |
|
| 692 |
static PyObject * |
| 693 |
_ctypes_PyCData___reduce___impl(PyObject *myself, PyTypeObject *cls); |
| 694 |
|
| 695 |
static PyObject * |
| 696 |
_ctypes_PyCData___reduce__(PyObject *myself, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 697 |
{ |
| 698 |
PyObject *return_value = NULL; |
| 699 |
|
| 700 |
if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) { |
| 701 |
PyErr_SetString(PyExc_TypeError, "__reduce__() takes no arguments"); |
| 702 |
goto exit; |
| 703 |
} |
| 704 |
Py_BEGIN_CRITICAL_SECTION(myself); |
| 705 |
return_value = _ctypes_PyCData___reduce___impl(myself, cls); |
| 706 |
Py_END_CRITICAL_SECTION(); |
| 707 |
|
| 708 |
exit: |
| 709 |
return return_value; |
| 710 |
} |
| 711 |
|
| 712 |
PyDoc_STRVAR(_ctypes_PyCData___setstate____doc__, |
| 713 |
"__setstate__($self, dict, data, /)\n" |
| 714 |
"--\n" |
| 715 |
"\n"); |
| 716 |
|
| 717 |
#define _CTYPES_PYCDATA___SETSTATE___METHODDEF \ |
| 718 |
{"__setstate__", _PyCFunction_CAST(_ctypes_PyCData___setstate__), METH_FASTCALL, _ctypes_PyCData___setstate____doc__}, |
| 719 |
|
| 720 |
static PyObject * |
| 721 |
_ctypes_PyCData___setstate___impl(PyObject *myself, PyObject *dict, |
| 722 |
const char *data, Py_ssize_t data_length); |
| 723 |
|
| 724 |
static PyObject * |
| 725 |
_ctypes_PyCData___setstate__(PyObject *myself, PyObject *const *args, Py_ssize_t nargs) |
| 726 |
{ |
| 727 |
PyObject *return_value = NULL; |
| 728 |
PyObject *dict; |
| 729 |
const char *data; |
| 730 |
Py_ssize_t data_length; |
| 731 |
|
| 732 |
if (!_PyArg_ParseStack(args, nargs, "O!s#:__setstate__", |
| 733 |
&PyDict_Type, &dict, &data, &data_length)) { |
| 734 |
goto exit; |
| 735 |
} |
| 736 |
Py_BEGIN_CRITICAL_SECTION(myself); |
| 737 |
return_value = _ctypes_PyCData___setstate___impl(myself, dict, data, data_length); |
| 738 |
Py_END_CRITICAL_SECTION(); |
| 739 |
|
| 740 |
exit: |
| 741 |
return return_value; |
| 742 |
} |
| 743 |
|
| 744 |
PyDoc_STRVAR(_ctypes_PyCData___ctypes_from_outparam____doc__, |
| 745 |
"__ctypes_from_outparam__($self, /)\n" |
| 746 |
"--\n" |
| 747 |
"\n" |
| 748 |
"default __ctypes_from_outparam__ method returns self."); |
| 749 |
|
| 750 |
#define _CTYPES_PYCDATA___CTYPES_FROM_OUTPARAM___METHODDEF \ |
| 751 |
{"__ctypes_from_outparam__", (PyCFunction)_ctypes_PyCData___ctypes_from_outparam__, METH_NOARGS, _ctypes_PyCData___ctypes_from_outparam____doc__}, |
| 752 |
|
| 753 |
static PyObject * |
| 754 |
_ctypes_PyCData___ctypes_from_outparam___impl(PyObject *self); |
| 755 |
|
| 756 |
static PyObject * |
| 757 |
_ctypes_PyCData___ctypes_from_outparam__(PyObject *self, PyObject *Py_UNUSED(ignored)) |
| 758 |
{ |
| 759 |
return _ctypes_PyCData___ctypes_from_outparam___impl(self); |
| 760 |
} |
| 761 |
|
| 762 |
#if !defined(_ctypes_CFuncPtr_errcheck_DOCSTR) |
| 763 |
# define _ctypes_CFuncPtr_errcheck_DOCSTR NULL |
| 764 |
#endif |
| 765 |
#if defined(_CTYPES_CFUNCPTR_ERRCHECK_GETSETDEF) |
| 766 |
# undef _CTYPES_CFUNCPTR_ERRCHECK_GETSETDEF |
| 767 |
# define _CTYPES_CFUNCPTR_ERRCHECK_GETSETDEF {"errcheck", (getter)_ctypes_CFuncPtr_errcheck_get, (setter)_ctypes_CFuncPtr_errcheck_set, _ctypes_CFuncPtr_errcheck_DOCSTR}, |
| 768 |
#else |
| 769 |
# define _CTYPES_CFUNCPTR_ERRCHECK_GETSETDEF {"errcheck", NULL, (setter)_ctypes_CFuncPtr_errcheck_set, NULL}, |
| 770 |
#endif |
| 771 |
|
| 772 |
static int |
| 773 |
_ctypes_CFuncPtr_errcheck_set_impl(PyCFuncPtrObject *self, PyObject *value); |
| 774 |
|
| 775 |
static int |
| 776 |
_ctypes_CFuncPtr_errcheck_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
| 777 |
{ |
| 778 |
int return_value; |
| 779 |
|
| 780 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 781 |
return_value = _ctypes_CFuncPtr_errcheck_set_impl((PyCFuncPtrObject *)self, value); |
| 782 |
Py_END_CRITICAL_SECTION(); |
| 783 |
|
| 784 |
return return_value; |
| 785 |
} |
| 786 |
|
| 787 |
PyDoc_STRVAR(_ctypes_CFuncPtr_errcheck__doc__, |
| 788 |
"a function to check for errors"); |
| 789 |
#if defined(_ctypes_CFuncPtr_errcheck_DOCSTR) |
| 790 |
# undef _ctypes_CFuncPtr_errcheck_DOCSTR |
| 791 |
#endif |
| 792 |
#define _ctypes_CFuncPtr_errcheck_DOCSTR _ctypes_CFuncPtr_errcheck__doc__ |
| 793 |
|
| 794 |
#if !defined(_ctypes_CFuncPtr_errcheck_DOCSTR) |
| 795 |
# define _ctypes_CFuncPtr_errcheck_DOCSTR NULL |
| 796 |
#endif |
| 797 |
#if defined(_CTYPES_CFUNCPTR_ERRCHECK_GETSETDEF) |
| 798 |
# undef _CTYPES_CFUNCPTR_ERRCHECK_GETSETDEF |
| 799 |
# define _CTYPES_CFUNCPTR_ERRCHECK_GETSETDEF {"errcheck", (getter)_ctypes_CFuncPtr_errcheck_get, (setter)_ctypes_CFuncPtr_errcheck_set, _ctypes_CFuncPtr_errcheck_DOCSTR}, |
| 800 |
#else |
| 801 |
# define _CTYPES_CFUNCPTR_ERRCHECK_GETSETDEF {"errcheck", (getter)_ctypes_CFuncPtr_errcheck_get, NULL, _ctypes_CFuncPtr_errcheck_DOCSTR}, |
| 802 |
#endif |
| 803 |
|
| 804 |
static PyObject * |
| 805 |
_ctypes_CFuncPtr_errcheck_get_impl(PyCFuncPtrObject *self); |
| 806 |
|
| 807 |
static PyObject * |
| 808 |
_ctypes_CFuncPtr_errcheck_get(PyObject *self, void *Py_UNUSED(context)) |
| 809 |
{ |
| 810 |
PyObject *return_value = NULL; |
| 811 |
|
| 812 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 813 |
return_value = _ctypes_CFuncPtr_errcheck_get_impl((PyCFuncPtrObject *)self); |
| 814 |
Py_END_CRITICAL_SECTION(); |
| 815 |
|
| 816 |
return return_value; |
| 817 |
} |
| 818 |
|
| 819 |
#if !defined(_ctypes_CFuncPtr_restype_DOCSTR) |
| 820 |
# define _ctypes_CFuncPtr_restype_DOCSTR NULL |
| 821 |
#endif |
| 822 |
#if defined(_CTYPES_CFUNCPTR_RESTYPE_GETSETDEF) |
| 823 |
# undef _CTYPES_CFUNCPTR_RESTYPE_GETSETDEF |
| 824 |
# define _CTYPES_CFUNCPTR_RESTYPE_GETSETDEF {"restype", (getter)_ctypes_CFuncPtr_restype_get, (setter)_ctypes_CFuncPtr_restype_set, _ctypes_CFuncPtr_restype_DOCSTR}, |
| 825 |
#else |
| 826 |
# define _CTYPES_CFUNCPTR_RESTYPE_GETSETDEF {"restype", NULL, (setter)_ctypes_CFuncPtr_restype_set, NULL}, |
| 827 |
#endif |
| 828 |
|
| 829 |
static int |
| 830 |
_ctypes_CFuncPtr_restype_set_impl(PyCFuncPtrObject *self, PyObject *value); |
| 831 |
|
| 832 |
static int |
| 833 |
_ctypes_CFuncPtr_restype_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
| 834 |
{ |
| 835 |
int return_value; |
| 836 |
|
| 837 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 838 |
return_value = _ctypes_CFuncPtr_restype_set_impl((PyCFuncPtrObject *)self, value); |
| 839 |
Py_END_CRITICAL_SECTION(); |
| 840 |
|
| 841 |
return return_value; |
| 842 |
} |
| 843 |
|
| 844 |
PyDoc_STRVAR(_ctypes_CFuncPtr_restype__doc__, |
| 845 |
"specify the result type"); |
| 846 |
#if defined(_ctypes_CFuncPtr_restype_DOCSTR) |
| 847 |
# undef _ctypes_CFuncPtr_restype_DOCSTR |
| 848 |
#endif |
| 849 |
#define _ctypes_CFuncPtr_restype_DOCSTR _ctypes_CFuncPtr_restype__doc__ |
| 850 |
|
| 851 |
#if !defined(_ctypes_CFuncPtr_restype_DOCSTR) |
| 852 |
# define _ctypes_CFuncPtr_restype_DOCSTR NULL |
| 853 |
#endif |
| 854 |
#if defined(_CTYPES_CFUNCPTR_RESTYPE_GETSETDEF) |
| 855 |
# undef _CTYPES_CFUNCPTR_RESTYPE_GETSETDEF |
| 856 |
# define _CTYPES_CFUNCPTR_RESTYPE_GETSETDEF {"restype", (getter)_ctypes_CFuncPtr_restype_get, (setter)_ctypes_CFuncPtr_restype_set, _ctypes_CFuncPtr_restype_DOCSTR}, |
| 857 |
#else |
| 858 |
# define _CTYPES_CFUNCPTR_RESTYPE_GETSETDEF {"restype", (getter)_ctypes_CFuncPtr_restype_get, NULL, _ctypes_CFuncPtr_restype_DOCSTR}, |
| 859 |
#endif |
| 860 |
|
| 861 |
static PyObject * |
| 862 |
_ctypes_CFuncPtr_restype_get_impl(PyCFuncPtrObject *self); |
| 863 |
|
| 864 |
static PyObject * |
| 865 |
_ctypes_CFuncPtr_restype_get(PyObject *self, void *Py_UNUSED(context)) |
| 866 |
{ |
| 867 |
PyObject *return_value = NULL; |
| 868 |
|
| 869 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 870 |
return_value = _ctypes_CFuncPtr_restype_get_impl((PyCFuncPtrObject *)self); |
| 871 |
Py_END_CRITICAL_SECTION(); |
| 872 |
|
| 873 |
return return_value; |
| 874 |
} |
| 875 |
|
| 876 |
#if !defined(_ctypes_CFuncPtr_argtypes_DOCSTR) |
| 877 |
# define _ctypes_CFuncPtr_argtypes_DOCSTR NULL |
| 878 |
#endif |
| 879 |
#if defined(_CTYPES_CFUNCPTR_ARGTYPES_GETSETDEF) |
| 880 |
# undef _CTYPES_CFUNCPTR_ARGTYPES_GETSETDEF |
| 881 |
# define _CTYPES_CFUNCPTR_ARGTYPES_GETSETDEF {"argtypes", (getter)_ctypes_CFuncPtr_argtypes_get, (setter)_ctypes_CFuncPtr_argtypes_set, _ctypes_CFuncPtr_argtypes_DOCSTR}, |
| 882 |
#else |
| 883 |
# define _CTYPES_CFUNCPTR_ARGTYPES_GETSETDEF {"argtypes", NULL, (setter)_ctypes_CFuncPtr_argtypes_set, NULL}, |
| 884 |
#endif |
| 885 |
|
| 886 |
static int |
| 887 |
_ctypes_CFuncPtr_argtypes_set_impl(PyCFuncPtrObject *self, PyObject *value); |
| 888 |
|
| 889 |
static int |
| 890 |
_ctypes_CFuncPtr_argtypes_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
| 891 |
{ |
| 892 |
int return_value; |
| 893 |
|
| 894 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 895 |
return_value = _ctypes_CFuncPtr_argtypes_set_impl((PyCFuncPtrObject *)self, value); |
| 896 |
Py_END_CRITICAL_SECTION(); |
| 897 |
|
| 898 |
return return_value; |
| 899 |
} |
| 900 |
|
| 901 |
PyDoc_STRVAR(_ctypes_CFuncPtr_argtypes__doc__, |
| 902 |
"specify the argument types"); |
| 903 |
#if defined(_ctypes_CFuncPtr_argtypes_DOCSTR) |
| 904 |
# undef _ctypes_CFuncPtr_argtypes_DOCSTR |
| 905 |
#endif |
| 906 |
#define _ctypes_CFuncPtr_argtypes_DOCSTR _ctypes_CFuncPtr_argtypes__doc__ |
| 907 |
|
| 908 |
#if !defined(_ctypes_CFuncPtr_argtypes_DOCSTR) |
| 909 |
# define _ctypes_CFuncPtr_argtypes_DOCSTR NULL |
| 910 |
#endif |
| 911 |
#if defined(_CTYPES_CFUNCPTR_ARGTYPES_GETSETDEF) |
| 912 |
# undef _CTYPES_CFUNCPTR_ARGTYPES_GETSETDEF |
| 913 |
# define _CTYPES_CFUNCPTR_ARGTYPES_GETSETDEF {"argtypes", (getter)_ctypes_CFuncPtr_argtypes_get, (setter)_ctypes_CFuncPtr_argtypes_set, _ctypes_CFuncPtr_argtypes_DOCSTR}, |
| 914 |
#else |
| 915 |
# define _CTYPES_CFUNCPTR_ARGTYPES_GETSETDEF {"argtypes", (getter)_ctypes_CFuncPtr_argtypes_get, NULL, _ctypes_CFuncPtr_argtypes_DOCSTR}, |
| 916 |
#endif |
| 917 |
|
| 918 |
static PyObject * |
| 919 |
_ctypes_CFuncPtr_argtypes_get_impl(PyCFuncPtrObject *self); |
| 920 |
|
| 921 |
static PyObject * |
| 922 |
_ctypes_CFuncPtr_argtypes_get(PyObject *self, void *Py_UNUSED(context)) |
| 923 |
{ |
| 924 |
PyObject *return_value = NULL; |
| 925 |
|
| 926 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 927 |
return_value = _ctypes_CFuncPtr_argtypes_get_impl((PyCFuncPtrObject *)self); |
| 928 |
Py_END_CRITICAL_SECTION(); |
| 929 |
|
| 930 |
return return_value; |
| 931 |
} |
| 932 |
|
| 933 |
#if !defined(_ctypes_Simple_value_DOCSTR) |
| 934 |
# define _ctypes_Simple_value_DOCSTR NULL |
| 935 |
#endif |
| 936 |
#if defined(_CTYPES_SIMPLE_VALUE_GETSETDEF) |
| 937 |
# undef _CTYPES_SIMPLE_VALUE_GETSETDEF |
| 938 |
# define _CTYPES_SIMPLE_VALUE_GETSETDEF {"value", (getter)_ctypes_Simple_value_get, (setter)_ctypes_Simple_value_set, _ctypes_Simple_value_DOCSTR}, |
| 939 |
#else |
| 940 |
# define _CTYPES_SIMPLE_VALUE_GETSETDEF {"value", NULL, (setter)_ctypes_Simple_value_set, NULL}, |
| 941 |
#endif |
| 942 |
|
| 943 |
static int |
| 944 |
_ctypes_Simple_value_set_impl(CDataObject *self, PyObject *value); |
| 945 |
|
| 946 |
static int |
| 947 |
_ctypes_Simple_value_set(PyObject *self, PyObject *value, void *Py_UNUSED(context)) |
| 948 |
{ |
| 949 |
int return_value; |
| 950 |
|
| 951 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 952 |
return_value = _ctypes_Simple_value_set_impl((CDataObject *)self, value); |
| 953 |
Py_END_CRITICAL_SECTION(); |
| 954 |
|
| 955 |
return return_value; |
| 956 |
} |
| 957 |
|
| 958 |
#if !defined(_ctypes_Simple_value_DOCSTR) |
| 959 |
# define _ctypes_Simple_value_DOCSTR NULL |
| 960 |
#endif |
| 961 |
#if defined(_CTYPES_SIMPLE_VALUE_GETSETDEF) |
| 962 |
# undef _CTYPES_SIMPLE_VALUE_GETSETDEF |
| 963 |
# define _CTYPES_SIMPLE_VALUE_GETSETDEF {"value", (getter)_ctypes_Simple_value_get, (setter)_ctypes_Simple_value_set, _ctypes_Simple_value_DOCSTR}, |
| 964 |
#else |
| 965 |
# define _CTYPES_SIMPLE_VALUE_GETSETDEF {"value", (getter)_ctypes_Simple_value_get, NULL, _ctypes_Simple_value_DOCSTR}, |
| 966 |
#endif |
| 967 |
|
| 968 |
static PyObject * |
| 969 |
_ctypes_Simple_value_get_impl(CDataObject *self); |
| 970 |
|
| 971 |
static PyObject * |
| 972 |
_ctypes_Simple_value_get(PyObject *self, void *Py_UNUSED(context)) |
| 973 |
{ |
| 974 |
PyObject *return_value = NULL; |
| 975 |
|
| 976 |
Py_BEGIN_CRITICAL_SECTION(self); |
| 977 |
return_value = _ctypes_Simple_value_get_impl((CDataObject *)self); |
| 978 |
Py_END_CRITICAL_SECTION(); |
| 979 |
|
| 980 |
return return_value; |
| 981 |
} |
| 982 |
|
| 983 |
PyDoc_STRVAR(Simple_from_outparm__doc__, |
| 984 |
"__ctypes_from_outparam__($self, /)\n" |
| 985 |
"--\n" |
| 986 |
"\n"); |
| 987 |
|
| 988 |
#define SIMPLE_FROM_OUTPARM_METHODDEF \ |
| 989 |
{"__ctypes_from_outparam__", _PyCFunction_CAST(Simple_from_outparm), METH_METHOD|METH_FASTCALL|METH_KEYWORDS, Simple_from_outparm__doc__}, |
| 990 |
|
| 991 |
static PyObject * |
| 992 |
Simple_from_outparm_impl(PyObject *self, PyTypeObject *cls); |
| 993 |
|
| 994 |
static PyObject * |
| 995 |
Simple_from_outparm(PyObject *self, PyTypeObject *cls, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) |
| 996 |
{ |
| 997 |
if (nargs || (kwnames && PyTuple_GET_SIZE(kwnames))) { |
| 998 |
PyErr_SetString(PyExc_TypeError, "__ctypes_from_outparam__() takes no arguments"); |
| 999 |
return NULL; |
| 1000 |
} |
| 1001 |
return Simple_from_outparm_impl(self, cls); |
| 1002 |
} |
| 1003 |
/*[clinic end generated code: output=9fb75bf7e9a17df2 input=a9049054013a1b77]*/ |