Home | History | Annotate | Download | only in _ctypes

Lines Matching defs:dict

133 /* This dict maps ctypes types to POINTER types */
178 PyObject *dict;
186 Py_XDECREF(self->dict);
194 if (self->key && self->dict) {
195 if (-1 == PyDict_DelItem(self->dict, self->key))
199 Py_CLEAR(self->dict);
249 PyDict_SetItemProxy(PyObject *dict, PyObject *key, PyObject *item)
262 assert(remover->dict == NULL);
265 Py_INCREF(dict);
266 remover->dict = dict;
273 result = PyDict_SetItem(dict, key, proxy);
279 PyDict_GetItemProxy(PyObject *dict, PyObject *key)
282 PyObject *item = PyDict_GetItem(dict, key);
404 StgDictObject *dict;
416 dict = (StgDictObject *)PyObject_CallObject((PyObject *)&PyCStgDict_Type, NULL);
417 if (!dict) {
421 /* replace the class dict by our updated stgdict, which holds info
423 if (-1 == PyDict_Update((PyObject *)dict, result->tp_dict)) {
425 Py_DECREF((PyObject *)dict);
428 Py_SETREF(result->tp_dict, (PyObject *)dict);
429 dict->format = _ctypes_alloc_format_string(NULL, "B");
430 if (dict->format == NULL) {
435 dict->paramfunc = StructUnionType_paramfunc;
437 fields = PyDict_GetItemString((PyObject *)dict, "_fields_");
443 /* copy base dict */
444 if (-1 == PyCStgDict_clone(dict, basedict)) {
448 dict->flags &= ~DICTFLAG_FINAL; /* clear the 'final' flag in the subclass dict */
449 basedict->flags |= DICTFLAG_FINAL; /* set the 'final' flag in the baseclass dict */
503 StgDictObject *dict = PyType_stgdict(type);
504 if (!dict) {
526 if (dict->size > buffer_len - offset) {
533 buffer_len, dict->size + offset);
562 StgDictObject *dict = PyType_stgdict(type);
563 if (!dict) {
586 if (dict->size > buffer_len - offset) {
593 buffer_len, dict->size + offset);
601 (char *)buffer+offset, dict->size);
680 StgDictObject *dict;
681 dict = PyType_stgdict(type);
684 is an instance of the type's dict->proto */
685 if(dict && ob) {
686 res = PyObject_IsInstance(ob, dict->proto);
754 StgDictObject *dict = PyType_stgdict((PyObject *)self);
755 if (dict)
756 Py_CLEAR(dict->proto);
763 StgDictObject *dict = PyType_stgdict((PyObject *)self);
764 if (dict)
765 Py_VISIT(dict->proto);
996 /* replace the class dict by our updated spam dict */
1011 StgDictObject *dict;
1013 dict = PyType_stgdict((PyObject *)self);
1014 assert(dict);
1016 if (-1 == PyCPointerType_SetProto(dict, type))
1019 if (-1 == PyDict_SetItemString((PyObject *)dict, "_type_", type))
1311 PyObject *dict = type->tp_dict;
1317 if (PyDict_SetItemString(dict, meth->ml_name, descr) < 0) {
1329 PyObject *dict = type->tp_dict;
1335 if (PyDict_SetItemString(dict, memb->name, descr) < 0) {
1348 PyObject *dict = type->tp_dict;
1354 if (PyDict_SetItemString(dict, gsp->name, descr) < 0) {
1469 /* replace the class dict by our updated spam dict */
1587 StgDictObject *dict;
1589 dict = dt && dt->proto ? PyType_stgdict(dt->proto) : NULL;
1590 if (dict && (dict->setfunc == _ctypes_get_fielddesc("u")->setfunc)) {
1598 StgDictObject *dict = PyObject_stgdict(a->obj);
1599 if (dict && (dict->setfunc == _ctypes_get_fielddesc("u")->setfunc)) {
1655 StgDictObject *dict;
1657 dict = dt && dt->proto ? PyType_stgdict(dt->proto) : NULL;
1658 if (dict && (dict->setfunc == _ctypes_get_fielddesc("c")->setfunc)) {
1666 StgDictObject *dict = PyObject_stgdict(a->obj);
1667 if (dict && (dict->setfunc == _ctypes_get_fielddesc("c")->setfunc)) {
1896 /* replace the class dict by our updated spam dict */
1910 StgDictObject *dict;
1915 dict = PyObject_stgdict((PyObject *)self);
1916 assert(dict); /* Cannot be NULL for CDataObject instances */
1917 fmt = PyString_AsString(dict->proto);
2024 /* replace the class dict by our updated spam dict */
2140 StgDictObject *dict;
2157 dict = PyType_stgdict(type);
2158 assert(dict);
2161 fmt = PyString_AsString(dict->proto);
2411 /* replace the class dict by our updated storage dict */
2540 * The index tuple is used as a key into the root object's b_objects dict.
2621 StgDictObject *dict = PyObject_stgdict(_self);
2632 view->format = dict->format ? dict->format : "B";
2633 view->ndim = dict->ndim;
2634 view->shape = dict->shape;
2638 view->itemsize /= dict->shape[i];
2710 PyObject *dict, *mydict;
2712 if (!PyArg_ParseTuple(args, "Os#", &dict, &data, &len))
2718 res = PyDict_Update(mydict, dict);
2785 static int PyCData_MallocBuffer(CDataObject *obj, StgDictObject *dict)
2787 if ((size_t)dict->size <= sizeof(obj->b_value)) {
2801 obj->b_ptr = (char *)PyMem_Malloc(dict->size);
2807 memset(obj->b_ptr, 0, dict->size);
2809 obj->b_size = dict->size;
2817 StgDictObject *dict;
2820 dict = PyType_stgdict(type);
2821 if (!dict) {
2826 dict->flags |= DICTFLAG_FINAL;
2832 cmem->b_length = dict->length;
2833 cmem->b_size = dict->size;
2842 if (-1 == PyCData_MallocBuffer(cmem, dict)) {
2846 memcpy(cmem->b_ptr, adr, dict->size);
2859 StgDictObject *dict;
2862 dict = PyType_stgdict(type);
2863 if (!dict) {
2868 dict->flags |= DICTFLAG_FINAL;
2875 pd->b_length = dict->length;
2876 pd->b_size = dict->size;
2898 StgDictObject *dict;
2902 dict = PyType_stgdict(type);
2903 if (dict && dict->getfunc && !_ctypes_simple_instance(type))
2904 return dict->getfunc(adr, size);
2922 StgDictObject *dict = PyType_stgdict(type);
2923 if (dict && dict->setfunc)
2924 return dict->setfunc(ptr, value, size);
3043 StgDictObject *dict;
3045 dict = PyType_stgdict((PyObject *)type);
3046 if (!dict) {
3051 dict->flags |= DICTFLAG_FINAL;
3060 obj->b_length = dict->length;
3062 if (-1 == PyCData_MallocBuffer(obj, dict)) {
3121 StgDictObject *dict;
3126 dict = PyObject_stgdict((PyObject *)self);
3127 assert(dict); /* Cannot be NULL for PyCFuncPtrObject instances */
3128 if (dict->restype) {
3129 Py_INCREF(dict->restype);
3130 return dict->restype;
3159 StgDictObject *dict;
3164 dict = PyObject_stgdict((PyObject *)self);
3165 assert(dict); /* Cannot be NULL for PyCFuncPtrObject instances */
3166 if (dict->argtypes) {
3167 Py_INCREF(dict->argtypes);
3168 return dict->argtypes;
3198 StgDictObject *dict;
3207 dict = PyType_stgdict((PyObject *)type);
3208 /* It should not happen that dict is NULL, but better be safe */
3209 if (dict==NULL || dict->flags & FUNCFLAG_CDECL)
3234 StgDictObject *dict;
3242 dict = PyType_stgdict(arg);
3243 if (dict
3245 && PyString_Check(dict->proto)
3247 && (strchr("PzZ", PyString_AS_STRING(dict->proto)[0]))) {
3265 StgDictObject *dict;
3268 dict = PyType_stgdict((PyObject *)type);
3269 assert(dict); /* Cannot be NULL. 'type' is a PyCFuncPtr type. */
3270 argtypes = dict->argtypes;
3272 if (paramflags == NULL || dict->argtypes == NULL)
3282 if (len != PyTuple_GET_SIZE(dict->argtypes)) {
3490 StgDictObject *dict;
3539 dict = PyType_stgdict((PyObject *)type);
3541 if (!dict || !dict->argtypes) {
3549 dict->argtypes,
3550 dict->restype,
3551 dict->flags);
3657 StgDictObject *dict;
3748 dict = PyType_stgdict(ob);
3749 if (dict == NULL) {
3756 if (PyString_Check(dict->proto)) {
3767 ob = PyObject_CallObject(dict->proto, NULL);
3889 StgDictObject *dict = PyObject_stgdict((PyObject *)self);
3902 assert(dict); /* Cannot be NULL for PyCFuncPtrObject instances */
3903 restype = self->restype ? self->restype : dict->restype;
3904 converters = self->converters ? self->converters : dict->converters;
3905 checker = self->checker ? self->checker : dict->checker;
3906 argtypes = self->argtypes ? self->argtypes : dict->argtypes;
3908 errcheck = self->errcheck /* ? self->errcheck : dict->errcheck */;
3955 if ((dict->flags & FUNCFLAG_CDECL) == FUNCFLAG_CDECL) {
3985 dict->flags,
4147 StgDictObject *dict;
4159 dict = PyType_stgdict((PyObject *)type);
4160 fields = PyDict_GetItemString((PyObject *)dict, "_fields_");
4165 i < dict->length && (i+index) < PyTuple_GET_SIZE(args);
4198 return index + dict->length;
4797 StgDictObject *dict = PyObject_stgdict((PyObject *)self);
4804 assert(dict); /* Cannot be NULL for CDataObject instances */
4805 assert(dict->setfunc);
4806 result = dict->setfunc(self->b_ptr, value, dict->size);
4828 StgDictObject *dict;
4829 dict = PyObject_stgdict((PyObject *)self);
4830 assert(dict); /* Cannot be NULL for CDataObject instances */
4831 assert(dict->getfunc);
4832 return dict->getfunc(self->b_ptr, self->b_size);
5115 StgDictObject *dict = PyType_stgdict((PyObject *)type);
5116 if (!dict || !dict->proto) {
5432 PyObject *dict = PyDict_New();
5437 if (dict == NULL)
5450 PyDict_SetItemString(dict, methods->ml_name, meth);
5458 status = PyDict_SetItemString(dict, "__doc__", s);
5465 dict);
5471 Py_DECREF(dict);
5488 StgDictObject *dict;
5494 dict = PyType_stgdict(arg);
5495 if (dict) {
5496 if (PyString_Check(dict->proto)
5497 && (strchr("sPzUZXO", PyString_AS_STRING(dict->proto)[0]))) {