Lines Matching defs:attrib
170 PyObject* attrib;
216 create_extra(ElementObject* self, PyObject* attrib)
224 Py_XINCREF(attrib);
225 self->extra->attrib = attrib;
242 Py_XDECREF(extra->attrib);
273 create_new_element(PyObject* tag, PyObject* attrib)
295 if (attrib != NULL && !is_empty_dict(attrib)) {
296 if (create_extra(self, attrib) < 0) {
325 /* Helper function for extracting the attrib dictionary from a keywords dict.
327 * either accept attrib as a keyword argument or all attributes splashed
331 * attrib. If there is no attrib keyword, return a copy of kwds.
336 PyObject *attrib_str = PyUnicode_FromString("attrib");
340 PyObject *attrib = PyDict_GetItemWithError(kwds, attrib_str);
342 if (attrib) {
343 /* If attrib was found in kwds, copy its value and remove it from
346 if (!PyDict_Check(attrib)) {
348 PyErr_Format(PyExc_TypeError, "attrib must be dict, not %.100s",
349 Py_TYPE(attrib)->tp_name);
352 attrib = PyDict_Copy(attrib);
353 if (attrib && PyDict_DelItem(kwds, attrib_str) < 0) {
354 Py_DECREF(attrib);
355 attrib = NULL;
359 attrib = PyDict_New();
364 if (attrib != NULL && PyDict_Update(attrib, kwds) < 0) {
365 Py_DECREF(attrib);
368 return attrib;
383 PyObject *attrib = NULL;
386 if (!PyArg_ParseTuple(args, "O|O!:Element", &tag, &PyDict_Type, &attrib))
389 if (attrib) {
390 /* attrib passed as positional arg */
391 attrib = PyDict_Copy(attrib);
392 if (!attrib)
395 if (PyDict_Update(attrib, kwds) < 0) {
396 Py_DECREF(attrib);
402 attrib = get_attrib_from_keywords(kwds);
403 if (!attrib)
409 if (attrib != NULL && !is_empty_dict(attrib)) {
410 if (create_extra(self_elem, attrib) < 0) {
411 Py_DECREF(attrib);
416 /* We own a reference to attrib here and it's no longer needed. */
417 Py_XDECREF(attrib);
520 /* return borrowed reference to attrib dictionary */
523 PyObject* res = self->extra->attrib;
527 res = self->extra->attrib = PyDict_New();
584 PyObject* attrib = NULL;
587 &PyDict_Type, &attrib)) {
591 if (attrib) {
592 /* attrib passed as positional arg */
593 attrib = PyDict_Copy(attrib);
594 if (!attrib)
596 if (kwds != NULL && PyDict_Update(attrib, kwds) < 0) {
597 Py_DECREF(attrib);
602 attrib = get_attrib_from_keywords(kwds);
603 if (!attrib)
606 /* no attrib arg, no kwds, so no attribute */
609 elem = create_new_element(tag, attrib);
610 Py_XDECREF(attrib);
631 Py_VISIT(self->extra->attrib);
724 self->tag, self->extra ? self->extra->attrib : NULL);
771 PyObject* attrib;
780 if (self->extra && self->extra->attrib) {
781 attrib = deepcopy(self->extra->attrib, memo);
782 if (!attrib) {
787 attrib = NULL;
790 element = (ElementObject*) create_new_element(tag, attrib);
793 Py_XDECREF(attrib);
918 #define PICKLED_ATTRIB "attrib"
938 PyObject *children, *attrib;
950 if (self->extra && self->extra->attrib) {
951 attrib = self->extra->attrib;
952 Py_INCREF(attrib);
955 attrib = PyDict_New();
956 if (!attrib) {
965 PICKLED_ATTRIB, attrib,
973 PyObject *attrib,
998 if (!children && !attrib) {
1024 assert(self->extra->attrib == NULL);
1025 self->extra->attrib = oldextra->attrib;
1026 oldextra->attrib = NULL;
1051 /* Stash attrib. */
1052 Py_XINCREF(attrib);
1053 Py_XSETREF(self->extra->attrib, attrib);
1069 PyObject *tag, *attrib, *text, *tail, *children;
1072 tag = attrib = text = tail = children = NULL;
1078 &attrib, &text, &tail, &children))
1079 retval = element_setstate_from_attributes(self, tag, attrib, text,
1384 if (self->extra && self->extra->attrib) {
1385 PyObject *attrib = self->extra->attrib;
1386 Py_INCREF(attrib);
1387 PyObject *value = PyDict_GetItemWithError(attrib, key);
1389 Py_DECREF(attrib);
1511 if (!self->extra || !self->extra->attrib)
1514 return PyDict_Items(self->extra->attrib);
1526 if (!self->extra || !self->extra->attrib)
1529 return PyDict_Keys(self->extra->attrib);
1545 attrib: object(subclass_of='&PyDict_Type')
1552 PyObject *attrib)
1557 attrib = PyDict_Copy(attrib);
1558 if (!attrib)
1561 elem = create_new_element(tag, attrib);
1563 Py_DECREF(attrib);
1658 PyObject* attrib;
1665 attrib = element_get_attrib(self);
1666 if (!attrib)
1669 if (PyDict_SetItem(attrib, key, value) < 0)
2027 "attrib must be dict, not %.200s",
2036 Py_XSETREF(self->extra->attrib, value);
2664 PyObject* attrib)
2675 node = create_new_element(tag, attrib);
2676 } else if (attrib == NULL) {
2677 attrib = PyDict_New();
2678 if (!attrib)
2681 tag, attrib, NULL);
2682 Py_DECREF(attrib);
2686 tag, attrib, NULL);
3246 PyObject* attrib;
3259 attrib = PyDict_New();
3260 if (!attrib) {
3270 Py_DECREF(attrib);
3274 ok = PyDict_SetItem(attrib, key, value);
3278 Py_DECREF(attrib);
3285 attrib = NULL;
3291 tag, attrib);
3294 if (attrib == NULL) {
3295 attrib = PyDict_New();
3296 if (!attrib) {
3302 tag, attrib, NULL);
3307 Py_XDECREF(attrib);
4197 {"attrib",